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/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 910d51c76f [fix](update) Fix where clause is not reanalyzed after
rewrite (#11723)
910d51c76f is described below
commit 910d51c76fb856ca504de65020395806292cfb11
Author: Zhengguo Yang <[email protected]>
AuthorDate: Mon Aug 15 13:24:57 2022 +0800
[fix](update) Fix where clause is not reanalyzed after rewrite (#11723)
---
fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java | 2 ++
regression-test/data/update/test_update_unique.out | 4 ++++
regression-test/suites/update/test_update_unique.groovy | 2 ++
3 files changed, 8 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java
index 23b182f9df..26577b5379 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/UpdateStmt.java
@@ -200,6 +200,8 @@ public class UpdateStmt extends DdlStmt {
}
whereExpr.analyze(analyzer);
whereExpr = analyzer.getExprRewriter().rewrite(whereExpr, analyzer,
ExprRewriter.ClauseType.WHERE_CLAUSE);
+ whereExpr.reset();
+ whereExpr.analyze(analyzer);
if (!whereExpr.getType().equals(Type.BOOLEAN)) {
throw new AnalysisException("Where clause is not a valid statement
return bool");
}
diff --git a/regression-test/data/update/test_update_unique.out
b/regression-test/data/update/test_update_unique.out
index 6df338a346..98f001495e 100644
--- a/regression-test/data/update/test_update_unique.out
+++ b/regression-test/data/update/test_update_unique.out
@@ -3,6 +3,10 @@
1 2 1 1999-01-01
2 2 1 1999-01-01
+-- !select_uniq_table --
+1 2 1 1998-01-01
+2 2 1 1998-01-01
+
-- !desc_uniq_table --
k INT Yes true \N
value1 INT Yes false \N REPLACE
diff --git a/regression-test/suites/update/test_update_unique.groovy
b/regression-test/suites/update/test_update_unique.groovy
index 667fb3d4df..21d2d26b13 100644
--- a/regression-test/suites/update/test_update_unique.groovy
+++ b/regression-test/suites/update/test_update_unique.groovy
@@ -34,6 +34,8 @@ suite("test_update_unique", "p0") {
sql "UPDATE ${tbName} SET value1 = value1+1 WHERE k=2;"
sql "UPDATE ${tbName} SET date_value = '1999-01-01' WHERE k in (1,2);"
qt_select_uniq_table "select * from ${tbName} order by k"
+ sql "UPDATE ${tbName} SET date_value = '1998-01-01' WHERE k is null or k
is not null;"
+ qt_select_uniq_table "select * from ${tbName} order by k"
qt_desc_uniq_table "desc ${tbName}"
sql "DROP TABLE ${tbName}"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]