[MDEV-9894] Assertion `0' failed in Window_func_runner::setup Created: 2016-04-10  Updated: 2016-04-14  Resolved: 2016-04-10

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - Window functions
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-9896 Testing for window functions Open
relates to MDEV-6115 window functions as in the SQL standard Closed

 Description   

drop table if exists t1;
create table t1 (i int);
insert into t1 values (1),(2);
SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1;

Stack trace from bb-10.2-mdev9543 commit e292ea8751f83ad0e23d16abc4599eac0390db94

#8  0x00007f87e7af7416 in Window_func_runner::setup (this=0x7f87b7d9c480, thd=0x7f87b7c14070) at sql/sql_window.cc:1769
#9  0x00007f87e7af76a4 in Window_funcs_sort::setup (this=0x7f87b7d9c458, thd=0x7f87b7c14070, sel=0x0, it=...) at sql/sql_window.cc:1838
#10 0x00007f87e7af78df in Window_funcs_computation::setup (this=0x7f87b7d9c438, thd=0x7f87b7c14070, window_funcs=0x7f87b7c18538, tab=0x7f87b7d9b660) at sql/sql_window.cc:1883
#11 0x00007f87e798e582 in JOIN::make_aggr_tables_info (this=0x7f87b7d99fd8) at sql/sql_select.cc:2666
#12 0x00007f87e798c0b3 in JOIN::optimize_inner (this=0x7f87b7d99fd8) at sql/sql_select.cc:2065
#13 0x00007f87e7988c5a in JOIN::optimize (this=0x7f87b7d99fd8) at sql/sql_select.cc:1063
#14 0x00007f87e7990efd in mysql_select (thd=0x7f87b7c14070, tables=0x7f87b7d998e0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f87b7d99fb8, unit=0x7f87b7c17ac0, select_lex=0x7f87b7c181e0) at sql/sql_select.cc:3517
#15 0x00007f87e7986862 in handle_select (thd=0x7f87b7c14070, lex=0x7f87b7c179f8, result=0x7f87b7d99fb8, setup_tables_done_option=0) at sql/sql_select.cc:377
#16 0x00007f87e79563cd in execute_sqlcom_select (thd=0x7f87b7c14070, all_tables=0x7f87b7d998e0) at sql/sql_parse.cc:6300
#17 0x00007f87e794c0fb in mysql_execute_command (thd=0x7f87b7c14070) at sql/sql_parse.cc:3339
#18 0x00007f87e7959a62 in mysql_parse (thd=0x7f87b7c14070, rawbuf=0x7f87b7d99088 "SELECT MAX( ALL 0 ) OVER ( PARTITION BY (i COLLATE latin1_general_ci) ROWS UNBOUNDED PRECEDING ) FROM t1", length=104, parser_state=0x7f87e73b39c0, is_next_command=false) at sql/sql_parse.cc:7703
#19 0x00007f87e7947fcd in dispatch_command (command=COM_QUERY, thd=0x7f87b7c14070, packet=0x7f87b7cba071 "SELECT MAX( ALL 0 ) OVER ( PARTITION BY (i COLLATE latin1_general_ci) ROWS UNBOUNDED PRECEDING ) FROM t1", packet_length=104, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:1791
#20 0x00007f87e7946a42 in do_command (thd=0x7f87b7c14070) at sql/sql_parse.cc:1354
#21 0x00007f87e7a7c6e0 in do_handle_one_connection (connect=0x7f87e4874f30) at sql/sql_connect.cc:1358
#22 0x00007f87e7a7c472 in handle_one_connection (arg=0x7f87e4874f30) at sql/sql_connect.cc:1264
#23 0x00007f87e5d32e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#24 0x00007f87e545fcbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#25 0x0000000000000000 in ?? ()



 Comments   
Comment by Sergei Petrunia [ 2016-04-10 ]

Ok, it asserts because MAX() is not yet supported as a window function (although we intend to support all of them eventually)

Comment by Sergei Petrunia [ 2016-04-10 ]

Fixed in the feature tree.

Comment by Elena Stepanova [ 2016-04-10 ]

Is it about specific functions? Because the same happens with (at least):

  • AVG
  • MIN
  • SUM
  • COUNT( DISTINCT ..
  • STDDEV_POP
  • STDDEV_SAMP
  • VAR_SAMP
  • VAR_POP
Comment by Sergei Petrunia [ 2016-04-10 ]

No, the patch makes the code return ER_NOT_SUPPORTED_YET for any aggregate function wasn't explicitly supported.

Generated at Thu Feb 08 07:38:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.