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

Possibly wrong result or Assertion `0' failed in Item_func_round::native_op

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.4, 10.5, 10.6
    • Fix Version/s: 10.4, 10.5, 10.6
    • Component/s: Data types
    • Labels:
      None

      Description

      The test case is not very smart and the debug assertion wouldn't be really important, but the concern is a result which is very different on 10.4+ from 10.3 (and from MySQL 5.6-8.0). It is hard to say which is correct, but it needs to be checked whether the change was intentional.

      CREATE TABLE t1 (a TIME, b INT);
      INSERT INTO t1 VALUES ('07:26:24',NULL),('23:55:04',NULL);
      SELECT MAX(ROUND(a, 0)) FROM t1 GROUP BY 1 << b;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 non-debug 29847a37

      SELECT MAX(ROUND(a, 0)) FROM t1 GROUP BY 1 << b;
      MAX(ROUND(a, 0))
      07:26:24
      DROP TABLE t1;
      

      Compare with the result on 10.3 (same on MySQL 5.6-8.0):

      10.3 ade782c0

      SELECT MAX(ROUND(a, 0)) FROM t1 GROUP BY 1 << b;
      MAX(ROUND(a, 0))
      235504
      DROP TABLE t1;
      

      Debug build of 10.4+ produces an assertion failure (10.3 doesn't).

      10.4 29847a37

      mysqld: /data/src/10.4/sql/item_func.h:1786: virtual bool Item_func_round::native_op(THD*, Native*): Assertion `0' failed.
      200929  2:49:11 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f591cd40f36 in __GI___assert_fail (assertion=0x561aba060467 "0", file=0x561aba0607d0 "/data/src/10.4/sql/item_func.h", line=1786, function=0x561aba060ed0 "virtual bool Item_func_round::native_op(THD*, Native*)") at assert.c:101
      #8  0x0000561ab95038d0 in Item_func_round::native_op (this=0x7f58fc013b58, thd=0x7f58fc000d90, to=0x7f58fc0159f8) at /data/src/10.4/sql/item_func.h:1786
      #9  0x0000561ab90d5e27 in Item_func_hybrid_field_type::val_native (this=0x7f58fc013b58, thd=0x7f58fc000d90, to=0x7f58fc0159f8) at /data/src/10.4/sql/item_func.h:820
      #10 0x0000561ab95627f4 in Arg_comparator::min_max_update_field_native (this=0x7f58fc015930, thd=0x7f58fc000d90, field=0x7f58fc0589a0, item=0x7f58fc013b58, cmp_sign=-1) at /data/src/10.4/sql/item_sum.cc:3113
      #11 0x0000561ab9562ab6 in Item_sum_min_max::min_max_update_native_field (this=0x7f58fc013c28) at /data/src/10.4/sql/item_sum.cc:3136
      #12 0x0000561ab95626a3 in Item_sum_min_max::update_field (this=0x7f58fc013c28) at /data/src/10.4/sql/item_sum.cc:3079
      #13 0x0000561ab917e926 in update_tmptable_sum_func (func_ptr=0x7f58fc015ab8, tmp_table=0x7f58fc057038) at /data/src/10.4/sql/sql_select.cc:25435
      #14 0x0000561ab9175706 in end_update (join=0x7f58fc0150b0, join_tab=0x7f58fc016a78, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:21919
      #15 0x0000561ab91884dc in AGGR_OP::put_record (this=0x7f58fc017460, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:28674
      #16 0x0000561ab918e9ef in AGGR_OP::put_record (this=0x7f58fc017460) at /data/src/10.4/sql/sql_select.h:1048
      #17 0x0000561ab9171068 in sub_select_postjoin_aggr (join=0x7f58fc0150b0, join_tab=0x7f58fc016a78, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20128
      #18 0x0000561ab9171cfa in evaluate_join_record (join=0x7f58fc0150b0, join_tab=0x7f58fc0166d0, error=0) at /data/src/10.4/sql/sql_select.cc:20628
      #19 0x0000561ab917178c in sub_select (join=0x7f58fc0150b0, join_tab=0x7f58fc0166d0, end_of_records=false) at /data/src/10.4/sql/sql_select.cc:20447
      #20 0x0000561ab9170a9c in do_select (join=0x7f58fc0150b0, procedure=0x0) at /data/src/10.4/sql/sql_select.cc:19946
      #21 0x0000561ab91457ab in JOIN::exec_inner (this=0x7f58fc0150b0) at /data/src/10.4/sql/sql_select.cc:4478
      #22 0x0000561ab91448da in JOIN::exec (this=0x7f58fc0150b0) at /data/src/10.4/sql/sql_select.cc:4260
      #23 0x0000561ab914602e in mysql_select (thd=0x7f58fc000d90, tables=0x7f58fc013e00, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f58fc014748, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f58fc015088, unit=0x7f58fc004cb8, select_lex=0x7f58fc0134f8) at /data/src/10.4/sql/sql_select.cc:4695
      #24 0x0000561ab9135a3f in handle_select (thd=0x7f58fc000d90, lex=0x7f58fc004bf8, result=0x7f58fc015088, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:410
      #25 0x0000561ab90fb4c4 in execute_sqlcom_select (thd=0x7f58fc000d90, all_tables=0x7f58fc013e00) at /data/src/10.4/sql/sql_parse.cc:6355
      #26 0x0000561ab90f1b16 in mysql_execute_command (thd=0x7f58fc000d90) at /data/src/10.4/sql/sql_parse.cc:3889
      #27 0x0000561ab90ff4cf in mysql_parse (thd=0x7f58fc000d90, rawbuf=0x7f58fc013438 "SELECT MAX(ROUND(a, 0)) FROM t1 GROUP BY 1 << b", length=47, parser_state=0x7f5912cff550, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
      #28 0x0000561ab90eb9de in dispatch_command (command=COM_QUERY, thd=0x7f58fc000d90, packet=0x7f58fc008791 "", packet_length=47, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1834
      #29 0x0000561ab90ea246 in do_command (thd=0x7f58fc000d90) at /data/src/10.4/sql/sql_parse.cc:1352
      #30 0x0000561ab9277e95 in do_handle_one_connection (connect=0x561abbe0b030) at /data/src/10.4/sql/sql_connect.cc:1412
      #31 0x0000561ab9277bde in handle_one_connection (arg=0x561abbe0b030) at /data/src/10.4/sql/sql_connect.cc:1316
      #32 0x0000561ab9c9230c in pfs_spawn_thread (arg=0x561abbd111b0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #33 0x00007f591d258609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #34 0x00007f591ce2c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration