Skip to content

Commit 23b81f8

Browse files
author
Dag Wanvik
committed
Bug#35443333 [backport] Hypergraph: regression for main.window_functions_bugs
Follow-up on Bug#35340987 Prepared SELECT returns different results on consecutive executions The fix for Bug#35340987 did not work for the hypergraph optimizer enabled since the compensatory code (calling update_used_tables of this fields in the JOIN) was put in make_tmp_tables_info - unused with hypergraph optimizer - hence never performed. This patch moves that code to JOIN::optimize where it can be reached by both optimizers. No new test is needed; just run ./mtr window_functions_bugs --hypergraph to verify. Change-Id: Ia5fd2fa5e09c001de2ac9b05155a061fd2b4e4e9
1 parent 530cb08 commit 23b81f8

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sql/sql_optimizer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ bool JOIN::optimize(bool finalize_access_paths) {
590590
m_windows_sort = true;
591591
break;
592592
}
593+
// This is necessary to undo effects of any previous execute's call to
594+
// CreateFramebufferTable->ReplaceMaterializedItems's calls of
595+
// update_used_tables: loses PROP_WINDOW_FUNCTION needed here in next
596+
// execution round
597+
if (m_windows.elements > 0)
598+
for (auto f : *fields) f->update_used_tables();
593599
}
594600

595601
sort_by_table = get_sort_by_table(order.order, group_list.order,

sql/sql_select.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4390,13 +4390,6 @@ bool JOIN::make_tmp_tables_info() {
43904390

43914391
DBUG_TRACE;
43924392

4393-
// This is necessary to undo effects of any previous execute's call to
4394-
// CreateFramebufferTable->ReplaceMaterializedItems's calls of
4395-
// update_used_tables: loses PROP_WINDOW_FUNCTION needed here in next
4396-
// execution round
4397-
if (m_windows.elements > 0)
4398-
for (auto f : *fields) f->update_used_tables();
4399-
44004393
/*
44014394
In this function, we may change having_cond into a condition on a
44024395
temporary sort/group table, so we have to assign having_for_explain now:

0 commit comments

Comments
 (0)