This is an automated email from the ASF dual-hosted git repository. eldenmoon 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 f6b6180462f [Fix](Variant) fix variant predicate rewrite OrToIn with wrong plan (#28695) f6b6180462f is described below commit f6b6180462fb828d529b6fb69638b7bd026671e1 Author: lihangyu <15605149...@163.com> AuthorDate: Fri Dec 22 11:51:36 2023 +0800 [Fix](Variant) fix variant predicate rewrite OrToIn with wrong plan (#28695) using the name without paths info will lead to wrong In plan, e.g. ``` where cast(v:a as text) = 'hello' or cast(v:b as text) = 'world' ``` will be rewrite to: ``` where cast(v as text) in ('hello', 'world') `` This is wrong, because they are different slots --- .../src/main/java/org/apache/doris/analysis/SlotRef.java | 3 +++ regression-test/data/variant_p0/sql/rewrite_or_to_in.out | 12 ++++++++++++ regression-test/suites/variant_p0/sql/rewrite_or_to_in.sql | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java index 62238b4dfba..52894f033a2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SlotRef.java @@ -540,6 +540,9 @@ public class SlotRef extends Expr { } public String getColumnName() { + if (subColPath != null && !subColPath.isEmpty()) { + return col + "." + String.join(".", subColPath); + } return col; } diff --git a/regression-test/data/variant_p0/sql/rewrite_or_to_in.out b/regression-test/data/variant_p0/sql/rewrite_or_to_in.out new file mode 100644 index 00000000000..81e664e6b10 --- /dev/null +++ b/regression-test/data/variant_p0/sql/rewrite_or_to_in.out @@ -0,0 +1,12 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !rewrite_or_to_in -- +0 + +-- !rewrite_or_to_in_2 -- +DeleteEvent megan777/calculator 2021-01-02T16:37:26Z +DeleteEvent megan777/calculator 2021-01-02T16:37:26Z +DeleteEvent megan777/calculator 2021-01-02T16:37:27Z +PushEvent megan777/calculator 2021-01-02T16:39:09Z +CreateEvent megan777/calculator 2021-01-02T16:39:41Z +PullRequestEvent megan777/calculator 2021-01-02T16:39:41Z + diff --git a/regression-test/suites/variant_p0/sql/rewrite_or_to_in.sql b/regression-test/suites/variant_p0/sql/rewrite_or_to_in.sql new file mode 100644 index 00000000000..e8fd6ac5605 --- /dev/null +++ b/regression-test/suites/variant_p0/sql/rewrite_or_to_in.sql @@ -0,0 +1,6 @@ +set rewrite_or_to_in_predicate_threshold = 2; +select + cast(v:type as string), cast(v:repo.name as string), cast(v:created_at as string) +from ghdata +where cast(v:type as string) = 'Delete' or cast(v:repo.name as string) = 'megan777/calculator' or cast(v:created_as as string) = '2021-01-02T16:37:26Z' +order by k limit 10; \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org