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

Assertion `0' failed in Item::val_native upon query with GROUP BY from Spider table

    XMLWordPrintable

Details

    Description

      Extracted from MDEV-23838, as it turned out to be a separate issue after all.

      Remember that the path to init_spider.inc may have to be changed, depending on the build.

      --source plugin/spider/spider/include/init_spider.inc
      --source include/have_partition.inc
       
      SET spider_same_server_link= on;
      eval create server s foreign data wrapper mysql options (host "127.0.0.1", database "test", user "root", port $MASTER_MYPORT);
       
      CREATE TABLE t1 (a TIME, b INT);
      INSERT INTO t1 VALUES ('10:00:00',1),('20:00:00',2);
      CREATE TABLE t2 (a TIME, b INT);
      INSERT INTO t2 VALUES ('11:00:00',3),('12:00:00',2);
       
      CREATE TABLE t_spider (a TIME, b INT) ENGINE=SPIDER PARTITION BY HASH(b) (
        PARTITION p1 COMMENT = "wrapper 'mysql', srv 's', table 't1'",
        PARTITION p2 COMMENT = "wrapper 'mysql', srv 's', table 't2'"  
      );
       
      SELECT b, MAX(a) FROM t_spider GROUP BY b;
       
      # Cleanup
      DROP TABLE t_spider, t1, t2;
       
      --source plugin/spider/spider/include/deinit_spider.inc
      

      10.4 30f3db3c

      Version: '10.4.31-MariaDB-debug-log'  socket: '/mnt8t/bld/10.4-asan/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
      mysqld: /data/src/10.4/sql/item.h:1355: virtual bool Item::val_native(THD*, Native*): Assertion `0' failed.
      230720 11:48:38 [ERROR] mysqld got signal 6 ;
       
      #8  0x00007f71a9225395 in __assert_fail_base (fmt=0x7f71a9399a70 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55e6cb8b31e0 "0", file=file@entry=0x55e6cb8b30a0 "/data/src/10.4/sql/item.h", line=line@entry=1355, function=function@entry=0x55e6cb8b3400 "virtual bool Item::val_native(THD*, Native*)") at ./assert/assert.c:92
      #9  0x00007f71a9233df2 in __GI___assert_fail (assertion=0x55e6cb8b31e0 "0", file=0x55e6cb8b30a0 "/data/src/10.4/sql/item.h", line=1355, function=0x55e6cb8b3400 "virtual bool Item::val_native(THD*, Native*)") at ./assert/assert.c:101
      #10 0x000055e6c95f0db8 in Item::val_native (this=0x62100008e928, thd=0x62b00005b208, to=0x62b000064ba8) at /data/src/10.4/sql/item.h:1355
      #11 0x000055e6ca2c9e8a in Arg_comparator::min_max_update_field_native (this=0x62b000064ae0, thd=0x62b00005b208, field=0x61900025db88, item=0x62100008e928, cmp_sign=-1) at /data/src/10.4/sql/item_sum.cc:3119
      #12 0x000055e6ca2ca589 in Item_sum_min_max::min_max_update_native_field (this=0x62b000062a18) at /data/src/10.4/sql/item_sum.cc:3142
      #13 0x000055e6ca2c9aee in Item_sum_min_max::update_field (this=0x62b000062a18) at /data/src/10.4/sql/item_sum.cc:3085
      #14 0x000055e6c9a11320 in update_tmptable_sum_func (func_ptr=0x62b000064c60, tmp_table=0x62300001c128) at /data/src/10.4/sql/sql_select.cc:26088
      #15 0x000055e6c99f7109 in end_update (join=0x62b000064058, join_tab=0x62b000065b10, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:22443
      #16 0x000055e6c9a2b863 in AGGR_OP::put_record (this=0x62b0000668f0, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:29601
      #17 0x000055e6c9a3acc1 in AGGR_OP::put_record (this=0x62b0000668f0) at /data/src/10.4/sql/sql_select.h:1084
      #18 0x000055e6c99e93c9 in sub_select_postjoin_aggr (join=0x62b000064058, join_tab=0x62b000065b10, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20596
      #19 0x000055e6c99ebcbd in evaluate_join_record (join=0x62b000064058, join_tab=0x62b000065768, error=0) at /data/src/10.4/sql/sql_select.cc:21116
      #20 0x000055e6c99eac12 in sub_select (join=0x62b000064058, join_tab=0x62b000065768, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20928
      #21 0x000055e6c99e8448 in do_select (join=0x62b000064058, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:20412
      #22 0x000055e6c99772d7 in JOIN::exec_inner (this=0x62b000064058) at /data/src/10.4/sql/sql_select.cc:4605
      #23 0x000055e6c99748de in JOIN::exec (this=0x62b000064058) at /data/src/10.4/sql/sql_select.cc:4387
      #24 0x000055e6c9978970 in mysql_select (thd=0x62b00005b208, tables=0x62b000062c10, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x62b000063458, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000064028, unit=0x62b00005f140, select_lex=0x62b0000622e8) at /data/src/10.4/sql/sql_select.cc:4826
      #25 0x000055e6c99495af in handle_select (thd=0x62b00005b208, lex=0x62b00005f080, result=0x62b000064028, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:442
      #26 0x000055e6c98b9361 in execute_sqlcom_select (thd=0x62b00005b208, all_tables=0x62b000062c10) at /data/src/10.4/sql/sql_parse.cc:6473
      #27 0x000055e6c98a6876 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:3976
      #28 0x000055e6c98c25b1 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "SELECT b, MAX(a) FROM t_spider GROUP BY b", length=41, parser_state=0x7f71a144e860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
      #29 0x000055e6c989887c in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x629000230209 "", packet_length=41, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #30 0x000055e6c98953eb in do_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:1378
      #31 0x000055e6c9c9407a in do_handle_one_connection (connect=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1420
      #32 0x000055e6c9c93991 in handle_one_connection (arg=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1324
      #33 0x000055e6ca902d5a in pfs_spawn_thread (arg=0x615000003508) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #34 0x00007f71a9287fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #35 0x00007f71a93085bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible on all existing versions.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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