You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/07/08 09:40:43 UTC
[doris] branch dev-1.0.1 updated: [fix](optimizer) join reorder may cause column non-existence problem (#10670)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/dev-1.0.1 by this push:
new c60ed8f18a [fix](optimizer) join reorder may cause column non-existence problem (#10670)
c60ed8f18a is described below
commit c60ed8f18aac93fe0a515a807387502829760e48
Author: yinzhijian <37...@qq.com>
AuthorDate: Fri Jul 8 17:28:32 2022 +0800
[fix](optimizer) join reorder may cause column non-existence problem (#10670)
for example:
select * from t1 inner join t2 on t1.a = t2.b inner join t3 on t3.c = t2.b;
If t3 is a large table, it will be placed first after the reorderTable,
and the problem that t2.b does not exist will occur in reanalyzing.
---
.../src/main/java/org/apache/doris/analysis/SelectStmt.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
index 84710d14c3..955f9650b4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java
@@ -817,7 +817,18 @@ public class SelectStmt extends QueryStmt {
List<Expr> candidateEqJoinPredicates = analyzer.getEqJoinConjunctsExcludeAuxPredicates(tid);
for (Expr candidateEqJoinPredicate : candidateEqJoinPredicates) {
List<TupleId> candidateTupleList = Lists.newArrayList();
- Expr.getIds(Lists.newArrayList(candidateEqJoinPredicate), candidateTupleList, null);
+ List<Expr> candidateEqJoinPredicateList = Lists.newArrayList(candidateEqJoinPredicate);
+ // If a large table or view has joinClause is ranked first,
+ // and the joinClause is not judged here,
+ // the column in joinClause may not be found during reanalyzing.
+ // for example:
+ // select * from t1 inner join t2 on t1.a = t2.b inner join t3 on t3.c = t2.b;
+ // If t3 is a large table, it will be placed first after the reorderTable,
+ // and the problem that t2.b does not exist will occur in reanalyzing
+ if (candidateTableRef.getOnClause() != null) {
+ candidateEqJoinPredicateList.add(candidateTableRef.getOnClause());
+ }
+ Expr.getIds(candidateEqJoinPredicateList, candidateTupleList, null);
int count = candidateTupleList.size();
for (TupleId tupleId : candidateTupleList) {
if (validTupleId.contains(tupleId) || tid.equals(tupleId)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org