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

Window functions crash when using INTERVAL

    Details

      Description

      The following use case crashes with window functions:

      create table t1(i int);
      insert into t1 values (1),(2);
       
      select interval(sum(i) over (order by i), 10, 20) from t1;  # Crash happens here.
      drop table t1;
      

      Thread 1 (Thread 0x7f4335af3700 (LWP 30528)):
      #0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
      #1  0x000000000127e99b in my_write_core (sig=11) at /home/vicentiu/Workspace/MariaDB-10.2/mysys/stacktrace.c:477
      #2  0x00000000009c7b00 in handle_fatal_signal (sig=11) at /home/vicentiu/Workspace/MariaDB-10.2/sql/signal_handler.cc:299
      #3  <signal handler called>
      #4  Field::set_notnull (this=0x0, row_offset=0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/field.h:1131
      #5  0x00000000009f59a1 in Item::save_in_field (this=0x7f4324012900, field=0x0, no_conversions=true) at /home/vicentiu/Workspace/MariaDB-10.2/sql/item.cc:6399
      #6  0x00000000008f90f3 in save_window_function_values (window_functions=..., tbl=0x7f4324185d68, rowid_buf=0x7f4324080fe0 "\020\226\016$C\177") at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_window.cc:2524
      #7  0x00000000008f8f43 in compute_window_func (thd=0x7f4324000b00, window_functions=..., cursor_managers=..., tbl=0x7f4324185d68, filesort_result=0x7f4324187a80) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_window.cc:2643
      #8  0x00000000008f938f in Window_func_runner::exec (this=0x7f43240158e0, thd=0x7f4324000b00, tbl=0x7f4324185d68, filesort_result=0x7f4324187a80) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_window.cc:2746
      #9  0x00000000008f9505 in Window_funcs_sort::exec (this=0x7f43240158d8, join=0x7f43240134e0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_window.cc:2774
      #10 0x00000000008f9efa in Window_funcs_computation::exec (this=0x7f43240158b8, join=0x7f43240134e0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_window.cc:2893
      #11 0x0000000000776074 in AGGR_OP::end_send (this=0x7f4324015698) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:26358
      #12 0x00000000007599ee in sub_select_postjoin_aggr (join=0x7f43240134e0, join_tab=0x7f43240149e8, end_of_records=true) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:18203
      #13 0x0000000000776332 in sub_select (join=0x7f43240134e0, join_tab=0x7f4324014638, end_of_records=true) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:18439
      #14 0x00000000007600f6 in do_select (join=0x7f43240134e0, procedure=0x0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:18034
      #15 0x000000000075ef27 in JOIN::exec_inner (this=0x7f43240134e0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:3473
      #16 0x000000000075e10e in JOIN::exec (this=0x7f43240134e0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:3274
      #17 0x000000000073bd8c in mysql_select (thd=0x7f4324000b00, tables=0x7f4324012dd0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f43240134c0, unit=0x7f43240045e0, select_lex=0x7f4324004d18) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:3668
      #18 0x000000000073b5ec in handle_select (thd=0x7f4324000b00, lex=0x7f4324004518, result=0x7f43240134c0, setup_tables_done_option=0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_select.cc:361
      #19 0x00000000006fe1b3 in execute_sqlcom_select (thd=0x7f4324000b00, all_tables=0x7f4324012dd0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_parse.cc:6438
      #20 0x00000000006f148c in mysql_execute_command (thd=0x7f4324000b00) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_parse.cc:3453
      #21 0x00000000006ed32a in mysql_parse (thd=0x7f4324000b00, rawbuf=0x7f4324012368 "select interval(sum(i) over (order by i), 10, 20) from t1", length=57, parser_state=0x7f4335af13d8, is_com_multi=false, is_next_command=false) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_parse.cc:7875
      #22 0x00000000006e8380 in dispatch_command (command=COM_QUERY, thd=0x7f4324000b00, packet=0x7f43240dfbe1 "", packet_length=57, is_com_multi=false, is_next_command=false) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_parse.cc:1816
      #23 0x00000000006ebada in do_command (thd=0x7f4324000b00) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_parse.cc:1361
      #24 0x0000000000872ac1 in do_handle_one_connection (connect=0x2ff5ff0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_connect.cc:1354
      #25 0x000000000087289a in handle_one_connection (arg=0x2ff5ff0) at /home/vicentiu/Workspace/MariaDB-10.2/sql/sql_connect.cc:1260
      #26 0x00000000010b64b4 in pfs_spawn_thread (arg=0x3019330) at /home/vicentiu/Workspace/MariaDB-10.2/storage/perfschema/pfs.cc:1862
      #27 0x00007f433e7d86ba in start_thread (arg=0x7f4335af3700) at pthread_create.c:333
      #28 0x00007f433c2ac82d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

        Attachments

          Activity

            People

            • Assignee:
              cvicentiu Vicențiu Ciorbaru
              Reporter:
              cvicentiu Vicențiu Ciorbaru
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: