Skip to content

Commit ea96e77

Browse files
author
Chaithra Gopalareddy
committed
Bug#36804785 `false' in operator at sql/sql_executor.cc
A const item that is part of group by and not found in select list is not added as a hidden item to the fields list post the fix for Bug#34951115. This is taken into consideration while checking for replacements for expressions involving ROLLUP operation during temp table creation i.e If a const item is not found the field list, same item is used as replacement as part of Bug#36444257. However, that fix only checked for const_item() and not const_for_execution(). The current bug reported fails the assertion for items that are not marked const, but only marked const for execution. Fix is to now check for const_for_execution() instead of const_item(). Change-Id: I35c717ec23010c69852623f336adfb77818f5080
1 parent b3fd569 commit ea96e77

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

mysql-test/r/olap.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,3 +2372,10 @@ CREATE TABLE t1(f1 INTEGER);
23722372
SELECT SUM(TAN(0)) OVER() FROM t1 GROUP BY TAN(0) WITH ROLLUP;
23732373
SUM(TAN(0)) OVER()
23742374
DROP TABLE t1;
2375+
#
2376+
# Bug#36804785: `false' in operator at sql/sql_executor.cc
2377+
#
2378+
CREATE TABLE t1(f1 INTEGER);
2379+
SELECT SUM(UTC_DATE()) OVER() FROM t1 GROUP BY UTC_DATE() WITH ROLLUP;
2380+
SUM(UTC_DATE()) OVER()
2381+
DROP TABLE t1;

mysql-test/t/olap.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,3 +1311,11 @@ DROP TABLE t;
13111311
CREATE TABLE t1(f1 INTEGER);
13121312
SELECT SUM(TAN(0)) OVER() FROM t1 GROUP BY TAN(0) WITH ROLLUP;
13131313
DROP TABLE t1;
1314+
1315+
--echo #
1316+
--echo # Bug#36804785: `false' in operator at sql/sql_executor.cc
1317+
--echo #
1318+
1319+
CREATE TABLE t1(f1 INTEGER);
1320+
SELECT SUM(UTC_DATE()) OVER() FROM t1 GROUP BY UTC_DATE() WITH ROLLUP;
1321+
DROP TABLE t1;

sql/sql_executor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4283,7 +4283,7 @@ static bool replace_embedded_rollup_references_with_tmp_fields(
42834283
// A const item that is part of group by and not found in
42844284
// select list will not be found in "fields" (It's not added
42854285
// as a hidden item).
4286-
if (unwrap_rollup_group(sub_item)->const_item()) {
4286+
if (unwrap_rollup_group(sub_item)->const_for_execution()) {
42874287
return {ReplaceResult::REPLACE, sub_item};
42884288
}
42894289
assert(false);

0 commit comments

Comments
 (0)