Skip to content

Commit

Permalink
[Fix](Planner) fix multi phase analysis failed in multi instance envi…
Browse files Browse the repository at this point in the history
…ronment substitution (#22840)

Problem:
When executing group_concat with order by inside in view, column can not be found when analyze.

Example:
create view if not exists test_view as select group_concat(c1,',' order by c1 asc) from table_group_concat;
select * from test_view;
it will return an error like: "can not find c1 in table_list"

Reason:
When we executing this sql in multi-instance environment, Planner would try to create plan in multi phase
aggregation. And because we analyze test_view independent with tables outside view. So we can not get
table informations inside view.

Solution:
Substitute order by expression of merge aggregation expressions.
  • Loading branch information
LiBinfeng-01 authored Aug 16, 2023
1 parent 7adb2be commit 2dbca7a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public void init(Analyzer analyzer) throws UserException {
// to our input; our conjuncts don't get substituted because they already
// refer to our output
outputSmap = getCombinedChildSmap();
if (aggInfo.isMerge()) {
aggInfo.substitute(aggInfo.getIntermediateSmap(), analyzer);
}
aggInfo.substitute(outputSmap, analyzer);

// assert consistent aggregate expr and slot materialization
Expand Down

0 comments on commit 2dbca7a

Please sign in to comment.