[MDEV-16051] window functions crash Created: 2018-04-27  Updated: 2019-01-04  Resolved: 2019-01-04

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - Window functions
Affects Version/s: 10.3.6, 10.2, 10.3
Fix Version/s: 10.3.11, 10.2.19

Type: Bug Priority: Critical
Reporter: sbester1 Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None
Environment:

Win x64


Issue Links:
Duplicate
is duplicated by MDEV-17366 Crash using two window functions Closed
Relates
relates to MDEV-17034 server crashes in Item_sum::set_aggr... Closed

 Description   

Version: '10.3.6-MariaDB'  socket: ''  port: 3306  mariadb.org binary distribution
180427 18:45:31 [ERROR] mysqld got exception 0xc0000005 ;
Item_field::Item_field()[item.cc:3075]
Window_funcs_sort::setup()[sql_window.cc:3006]
Window_funcs_computation::setup()[sql_window.cc:3045]
JOIN::make_aggr_tables_info()[sql_select.cc:3216]
JOIN::optimize_stage2()[sql_select.cc:2565]
JOIN::optimize_inner()[sql_select.cc:1859]
JOIN::optimize()[sql_select.cc:1433]
mysql_select()[sql_select.cc:4138]
handle_select()[sql_select.cc:370]
execute_sqlcom_select()[sql_parse.cc:6539]
mysql_execute_command()[sql_parse.cc:3768]
mysql_parse()[sql_parse.cc:8006]
dispatch_command()[sql_parse.cc:1848]
do_command()[sql_parse.cc:1390]
threadpool_process_request()[threadpool_common.cc:358]
tp_callback()[threadpool_common.cc:186]

How to Repeat:

drop table if exists t;
create table t(a int)engine=innodb;
insert into t values(1),(2),(3);
select ntile(124)over() from t 
where @g not like 1
group by @f 
order by a;



 Comments   
Comment by Elena Stepanova [ 2018-04-27 ]

Thanks for the report and test case.

Comment by Alice Sherepa [ 2019-01-04 ]

Fixed in the scope of MDEV-12575 by a12b8ac8e9636f commit by Varun Gupta

commit a12b8ac8e9636f8258bcb17a0845b9317d870fd9
Author: Varun Gupta <varunraiko1803@gmail.com>
Date:   Fri Nov 9 19:53:40 2018 +0530
 
    MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free or Invalid write in JOIN::make_aggr_tables_info
    
    During the optimize state of a query, we come know that the result set
    would atmost contain one row, then for such a query we don't need
    to compute GROUP BY, ORDER BY and DISTINCT.

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