Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10875

Assertion `join->group_list || !join->is_in_subquery()' failed on subquery with window function

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (1),(2);
       
      CREATE TABLE t2 (c VARCHAR(8));
      INSERT INTO t2 VALUES ('foo'),('bar');
       
      SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
      

      Stack trace from 10.2 c82c375eea

      Version: '10.2.2-MariaDB-debug-log'  socket: '/data/bld/10.2/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
      mysqld: /data/src/10.2/sql/sql_select.cc:21408: int create_sort_index(THD*, JOIN*, JOIN_TAB*, Filesort*): Assertion `join->group_list || !join->is_in_subquery()' failed.
      160923  1:25:51 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f57fd78f312 in __GI___assert_fail (assertion=0x7f5800a92b80 "join->group_list || !join->is_in_subquery()", file=0x7f5800a90ee8 "/data/src/10.2/sql/sql_select.cc", line=21408, function=0x7f5800a950e0 <create_sort_index(THD*, JOIN*, st_join_table*, Filesort*)::__PRETTY_FUNCTION__> "int create_sort_index(THD*, JOIN*, JOIN_TAB*, Filesort*)") at assert.c:101
      #8  0x00007f5800091464 in create_sort_index (thd=0x7f57f4816070, join=0x7f57f4866b70, tab=0x7f57f4918438, fsort=0x7f57f4918c50) at /data/src/10.2/sql/sql_select.cc:21408
      #9  0x00007f58001d81c8 in Window_funcs_sort::exec (this=0x7f57f4918bb8, join=0x7f57f4866b70) at /data/src/10.2/sql/sql_window.cc:2377
      #10 0x00007f58001d857e in Window_funcs_computation::exec (this=0x7f57f4918b98, join=0x7f57f4866b70) at /data/src/10.2/sql/sql_window.cc:2465
      #11 0x00007f580009e620 in AGGR_OP::end_send (this=0x7f57f4869f50) at /data/src/10.2/sql/sql_select.cc:26203
      #12 0x00007f58000898e5 in sub_select_postjoin_aggr (join=0x7f57f4866b70, join_tab=0x7f57f4918438, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18052
      #13 0x00007f5800089c0b in sub_select (join=0x7f57f4866b70, join_tab=0x7f57f4918088, end_of_records=true) at /data/src/10.2/sql/sql_select.cc:18288
      #14 0x00007f5800089446 in do_select (join=0x7f57f4866b70, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:17883
      #15 0x00007f58000643da in JOIN::exec_inner (this=0x7f57f4866b70) at /data/src/10.2/sql/sql_select.cc:3371
      #16 0x00007f5800063924 in JOIN::exec (this=0x7f57f4866b70) at /data/src/10.2/sql/sql_select.cc:3182
      #17 0x00007f58001b98ce in join_tab_execution_startup (tab=0x7f57f491b060) at /data/src/10.2/sql/opt_subselect.cc:5125
      #18 0x00007f5800089d6d in sub_select (join=0x7f57f4866378, join_tab=0x7f57f491b060, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18325
      #19 0x00007f580008a531 in evaluate_join_record (join=0x7f57f4866378, join_tab=0x7f57f491acb0, error=0) at /data/src/10.2/sql/sql_select.cc:18562
      #20 0x00007f5800089e33 in sub_select (join=0x7f57f4866378, join_tab=0x7f57f491acb0, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18337
      #21 0x00007f58000893f1 in do_select (join=0x7f57f4866378, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:17881
      #22 0x00007f58000643da in JOIN::exec_inner (this=0x7f57f4866378) at /data/src/10.2/sql/sql_select.cc:3371
      #23 0x00007f5800063924 in JOIN::exec (this=0x7f57f4866378) at /data/src/10.2/sql/sql_select.cc:3182
      #24 0x00007f5800064a7b in mysql_select (thd=0x7f57f4816070, tables=0x7f57f48642d8, wild_num=1, fields=..., conds=0x7f57f4866038, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f57f4866358, unit=0x7f57f4819b18, select_lex=0x7f57f481a250) at /data/src/10.2/sql/sql_select.cc:3567
      #25 0x00007f5800059bb7 in handle_select (thd=0x7f57f4816070, lex=0x7f57f4819a50, result=0x7f57f4866358, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
      #26 0x00007f5800027795 in execute_sqlcom_select (thd=0x7f57f4816070, all_tables=0x7f57f48642d8) at /data/src/10.2/sql/sql_parse.cc:6345
      #27 0x00007f580001d2e3 in mysql_execute_command (thd=0x7f57f4816070) at /data/src/10.2/sql/sql_parse.cc:3376
      #28 0x00007f580002b154 in mysql_parse (thd=0x7f57f4816070, rawbuf=0x7f57f4864088 "SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 )", length=77, parser_state=0x7f5801122dd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7788
      #29 0x00007f5800018f39 in dispatch_command (command=COM_QUERY, thd=0x7f57f4816070, packet=0x7f57f4858071 "", packet_length=77, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
      #30 0x00007f5800017913 in do_command (thd=0x7f57f4816070) at /data/src/10.2/sql/sql_parse.cc:1365
      #31 0x00007f580015d22c in do_handle_one_connection (connect=0x7f57fcc6d410) at /data/src/10.2/sql/sql_connect.cc:1354
      #32 0x00007f580015cfb9 in handle_one_connection (arg=0x7f57fcc6d410) at /data/src/10.2/sql/sql_connect.cc:1260
      #33 0x00007f5800487bac in pfs_spawn_thread (arg=0x7f57fcc519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #34 0x00007f57ff6910a4 in start_thread (arg=0x7f5801124300) at pthread_create.c:309
      #35 0x00007f57fd84987d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Note: there is also MDEV-9513 about the same assertion failure, but the case and stack trace look essentially different there.

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.