This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new e435e6f [Bug][Planner]Fix bug of count(*) in MV selector (#4060) e435e6f is described below commit e435e6f9a89bb67d10c39269c97b49e921547561 Author: EmmyMiao87 <522274...@qq.com> AuthorDate: Mon Jul 13 20:53:10 2020 +0800 [Bug][Planner]Fix bug of count(*) in MV selector (#4060) The output columns of query should be collected by all of tupleIds in BaseTableRef rather than the top tupleIds of query. The top tupleIds of count(*) is Agg tuple which does not expand the star. Fixed #4065 --- fe/src/main/java/org/apache/doris/analysis/SelectStmt.java | 13 +++++++++++++ .../org/apache/doris/planner/MaterializedViewSelector.java | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fe/src/main/java/org/apache/doris/analysis/SelectStmt.java b/fe/src/main/java/org/apache/doris/analysis/SelectStmt.java index f4e66f9..2ad443b 100644 --- a/fe/src/main/java/org/apache/doris/analysis/SelectStmt.java +++ b/fe/src/main/java/org/apache/doris/analysis/SelectStmt.java @@ -497,6 +497,19 @@ public class SelectStmt extends QueryStmt { return result; } + public List<TupleId> getTableRefIdsWithoutInlineView() { + List<TupleId> result = Lists.newArrayList(); + + for (TableRef ref : fromClause_) { + if (ref instanceof InlineViewRef) { + continue; + } + result.add(ref.getId()); + } + + return result; + } + @Override public List<TupleId> collectTupleIds() { List<TupleId> result = Lists.newArrayList(); diff --git a/fe/src/main/java/org/apache/doris/planner/MaterializedViewSelector.java b/fe/src/main/java/org/apache/doris/planner/MaterializedViewSelector.java index e050271..35a9990 100644 --- a/fe/src/main/java/org/apache/doris/planner/MaterializedViewSelector.java +++ b/fe/src/main/java/org/apache/doris/planner/MaterializedViewSelector.java @@ -43,7 +43,6 @@ import com.google.common.collect.Sets; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -474,8 +473,7 @@ public class MaterializedViewSelector { // Step4: compute the output column // ISSUE-3174: all of columns which belong to top tuple should be considered in selector. - ArrayList<TupleId> topTupleIds = Lists.newArrayList(); - selectStmt.getMaterializedTupleIds(topTupleIds); + List<TupleId> topTupleIds = selectStmt.getTableRefIdsWithoutInlineView(); for (TupleId tupleId : topTupleIds) { TupleDescriptor tupleDescriptor = analyzer.getTupleDesc(tupleId); tupleDescriptor.getTableNameToColumnNames(columnNamesInQueryOutput); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org