MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
A temporary table is needed for window function computation but if only a NAMED WINDOW SPEC is used and there is no window function, then there is no need to create a temporary table as there is no stage to compute WINDOW FUNCTION
This commit is contained in:
parent
cf52dd174e
commit
4a6b28c7b9
@ -3724,5 +3724,24 @@ MAX(1) OVER () COUNT(a) abs(a)
|
|||||||
1 0 NULL
|
1 0 NULL
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
|
||||||
|
#
|
||||||
|
CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY ) ;
|
||||||
|
INSERT INTO t0 VALUES (1),(2),(3);
|
||||||
|
SELECT a FROM t0
|
||||||
|
WHERE a < 8
|
||||||
|
GROUP BY 1.5
|
||||||
|
WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
|
||||||
|
a
|
||||||
|
1
|
||||||
|
SELECT a, ROW_NUMBER() OVER v2
|
||||||
|
FROM t0
|
||||||
|
WHERE a < 8
|
||||||
|
GROUP BY 1.5
|
||||||
|
WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
|
||||||
|
a ROW_NUMBER() OVER v2
|
||||||
|
1 1
|
||||||
|
drop table t0;
|
||||||
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
|
@ -2426,6 +2426,26 @@ SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-22461: JOIN::make_aggr_tables_info(): Assertion `select_options & (1ULL << 17)' failed.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE t0 (a INT PRIMARY KEY ) ;
|
||||||
|
INSERT INTO t0 VALUES (1),(2),(3);
|
||||||
|
|
||||||
|
SELECT a FROM t0
|
||||||
|
WHERE a < 8
|
||||||
|
GROUP BY 1.5
|
||||||
|
WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
|
||||||
|
|
||||||
|
SELECT a, ROW_NUMBER() OVER v2
|
||||||
|
FROM t0
|
||||||
|
WHERE a < 8
|
||||||
|
GROUP BY 1.5
|
||||||
|
WINDOW v2 AS ( PARTITION BY a ORDER BY a DESC );
|
||||||
|
|
||||||
|
drop table t0;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -2014,11 +2014,16 @@ JOIN::optimize_inner()
|
|||||||
}
|
}
|
||||||
|
|
||||||
need_tmp= test_if_need_tmp_table();
|
need_tmp= test_if_need_tmp_table();
|
||||||
//TODO this could probably go in test_if_need_tmp_table.
|
|
||||||
if (this->select_lex->window_specs.elements > 0) {
|
/*
|
||||||
need_tmp= TRUE;
|
If window functions are present then we can't have simple_order set to
|
||||||
|
TRUE as the window function needs a temp table for computation.
|
||||||
|
ORDER BY is computed after the window function computation is done, so
|
||||||
|
the sort will be done on the temp table.
|
||||||
|
*/
|
||||||
|
if (select_lex->have_window_funcs())
|
||||||
simple_order= FALSE;
|
simple_order= FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table
|
If the hint FORCE INDEX FOR ORDER BY/GROUP BY is used for the table
|
||||||
|
@ -1636,6 +1636,7 @@ public:
|
|||||||
- We are using an ORDER BY or GROUP BY on fields not in the first table
|
- We are using an ORDER BY or GROUP BY on fields not in the first table
|
||||||
- We are using different ORDER BY and GROUP BY orders
|
- We are using different ORDER BY and GROUP BY orders
|
||||||
- The user wants us to buffer the result.
|
- The user wants us to buffer the result.
|
||||||
|
- We are using WINDOW functions.
|
||||||
When the WITH ROLLUP modifier is present, we cannot skip temporary table
|
When the WITH ROLLUP modifier is present, we cannot skip temporary table
|
||||||
creation for the DISTINCT clause just because there are only const tables.
|
creation for the DISTINCT clause just because there are only const tables.
|
||||||
*/
|
*/
|
||||||
@ -1645,7 +1646,8 @@ public:
|
|||||||
((select_distinct || !simple_order || !simple_group) ||
|
((select_distinct || !simple_order || !simple_group) ||
|
||||||
(group_list && order) ||
|
(group_list && order) ||
|
||||||
MY_TEST(select_options & OPTION_BUFFER_RESULT))) ||
|
MY_TEST(select_options & OPTION_BUFFER_RESULT))) ||
|
||||||
(rollup.state != ROLLUP::STATE_NONE && select_distinct));
|
(rollup.state != ROLLUP::STATE_NONE && select_distinct) ||
|
||||||
|
select_lex->have_window_funcs());
|
||||||
}
|
}
|
||||||
bool choose_subquery_plan(table_map join_tables);
|
bool choose_subquery_plan(table_map join_tables);
|
||||||
void get_partial_cost_and_fanout(int end_tab_idx,
|
void get_partial_cost_and_fanout(int end_tab_idx,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user