This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 7f14692d0a7 [fix](planner)fix bug of bound conjunct to wrong tuple
(#28812)
7f14692d0a7 is described below
commit 7f14692d0a76bcfaa3e8c34cf5482e1e24f26611
Author: starocean999 <[email protected]>
AuthorDate: Fri Dec 22 21:43:38 2023 +0800
[fix](planner)fix bug of bound conjunct to wrong tuple (#28812)
---
fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java | 6 +++---
regression-test/suites/correctness_p0/test_rand_filter.groovy | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index 02fbc137b36..6329882d862 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -1271,12 +1271,12 @@ public class Analyzer {
public void registerConjuncts(Expr e, boolean fromHavingClause,
List<TupleId> ids) throws AnalysisException {
for (Expr conjunct : e.getConjuncts()) {
registerConjunct(conjunct);
- if (!e.isConstant()) {
+ if (!conjunct.isConstant()) {
ArrayList<TupleId> tupleIds = Lists.newArrayList();
ArrayList<SlotId> slotIds = Lists.newArrayList();
- e.getIds(tupleIds, slotIds);
+ conjunct.getIds(tupleIds, slotIds);
if (tupleIds.isEmpty() && slotIds.isEmpty()) {
- e.setBoundTupleIds(ids);
+ conjunct.setBoundTupleIds(ids);
}
}
if (ids != null) {
diff --git a/regression-test/suites/correctness_p0/test_rand_filter.groovy
b/regression-test/suites/correctness_p0/test_rand_filter.groovy
index ccad3161caf..40f5e1fe209 100644
--- a/regression-test/suites/correctness_p0/test_rand_filter.groovy
+++ b/regression-test/suites/correctness_p0/test_rand_filter.groovy
@@ -32,5 +32,11 @@ suite("test_rand_filter") {
sql("""select * from test_rand_filter_t where rand() < 0.5 union all
select * from test_rand_filter_t where rand() > 0.3;""")
notContains("AND")
}
+ explain {
+ sql("""select * from test_rand_filter_t
+ union all (select * from test_rand_filter_t where rand() <
0.3)
+ union all (select * from test_rand_filter_t where a > 5 and
rand() < 0.4);""")
+ notContains("rand() < 0.3 AND rand() < 0.4")
+ }
sql """ DROP TABLE IF EXISTS test_rand_filter_t """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]