This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new f376d38e26d branch-4.0: [fix](nereids) legacy expr clone need update
nullableFromNereids #56552 (#56623)
f376d38e26d is described below
commit f376d38e26d3bcb667363783673352ca2a90b6ed
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Sep 29 16:05:41 2025 +0800
branch-4.0: [fix](nereids) legacy expr clone need update
nullableFromNereids #56552 (#56623)
Cherry-picked from #56552
Co-authored-by: yujun <[email protected]>
---
.../java/org/apache/doris/analysis/CastExpr.java | 1 -
.../main/java/org/apache/doris/analysis/Expr.java | 1 +
.../test_clone_legacy_nullable_from_nereids.out | 4 ++
.../test_clone_legacy_nullable_from_nereids.groovy | 71 ++++++++++++++++++++++
4 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index e2d04d352a8..c1ca5b735cc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -184,7 +184,6 @@ public class CastExpr extends Expr {
targetTypeDef = other.targetTypeDef;
isImplicit = other.isImplicit;
noOp = other.noOp;
- nullableFromNereids = other.nullableFromNereids;
}
private static String getFnName(Type targetType) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
index 702d92fb425..35bc01dc8d2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
@@ -202,6 +202,7 @@ public abstract class Expr extends TreeNode<Expr>
implements Cloneable, ExprStat
fn = other.fn;
printSqlInParens = other.printSqlInParens;
children = Expr.cloneList(other.children);
+ nullableFromNereids = other.nullableFromNereids;
}
public boolean isAnalyzed() {
diff --git
a/regression-test/data/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.out
b/regression-test/data/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.out
new file mode 100644
index 00000000000..2871306509f
--- /dev/null
+++
b/regression-test/data/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.out
@@ -0,0 +1,4 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !select --
+\N
+
diff --git
a/regression-test/suites/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.groovy
b/regression-test/suites/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.groovy
new file mode 100644
index 00000000000..3b0a9e31a53
--- /dev/null
+++
b/regression-test/suites/nereids_p0/legacy/test_clone_legacy_nullable_from_nereids.groovy
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_clone_legacy_nullable_from_nereids") {
+ // the agg will cause legacy expr clone, but old code expr clone no set
nullableFromNereids,
+ // then it will cause error:
+ // Could not find function lt, arg (CAST
col_date_undef_signed_not_null(DateV2) TO DateTimeV2(0)): DateTimeV2(0),
+ // (CAST
VectorizedFnCall[hours_sub](arguments=col_datetime_6__undef_signed_not_null,
INT,return=DateTimeV2(6))(DateTimeV2(6)) TO Nullable(DateTimeV2(0))):
+ // Nullable(DateTimeV2(0)) return BOOL
+ sql """
+ drop table if exists tbl_test_clone_legacy_nullable_from_nereids force;
+ create table tbl_test_clone_legacy_nullable_from_nereids (
+ col_datetime_6__undef_signed_not_null datetime(6) not null ,
+ pk int,
+ col_date_undef_signed date null ,
+ col_date_undef_signed_not_null date not null ,
+ col_datetime_undef_signed datetime null ,
+ col_datetime_undef_signed_not_null datetime not null ,
+ col_datetime_3__undef_signed datetime(3) null ,
+ col_datetime_3__undef_signed_not_null datetime(3) not null ,
+ col_datetime_6__undef_signed datetime(6) null
+ ) engine=olap
+ DUPLICATE KEY(col_datetime_6__undef_signed_not_null, pk)
+ PARTITION BY RANGE(col_datetime_6__undef_signed_not_null) (
+ PARTITION p0 VALUES LESS THAN ("1997-01-01 00:00:00"),
+ PARTITION p1 VALUES LESS THAN ("2010-01-01 00:00:00"),
+ PARTITION p2 VALUES LESS THAN ("2020-01-01 00:00:00"),
+ PARTITION p3 VALUES LESS THAN ("2030-01-01 00:00:00"),
+ PARTITION p4 VALUES LESS THAN ("2040-01-01 00:00:00"),
+ PARTITION p5 VALUES LESS THAN ("2050-01-01 00:00:00"),
+ PARTITION p6 VALUES LESS THAN ("2060-01-01 00:00:00"),
+ PARTITION p7 VALUES LESS THAN ("2070-01-01 00:00:00"),
+ PARTITION p8 VALUES LESS THAN ("2180-01-01 00:00:00"),
+ PARTITION p9 VALUES LESS THAN ("9999-01-01 00:00:00"),
+ PARTITION p10 VALUES LESS THAN (MAXVALUE)
+ )
+
+ distributed by hash(pk) buckets 10
+ properties("replication_num" = "1");
+ insert into tbl_test_clone_legacy_nullable_from_nereids(
+
pk,col_date_undef_signed,col_date_undef_signed_not_null,col_datetime_undef_signed,
+
col_datetime_undef_signed_not_null,col_datetime_3__undef_signed,
+
col_datetime_3__undef_signed_not_null,col_datetime_6__undef_signed,col_datetime_6__undef_signed_not_null)
+ values (0,'2024-08-03 13:08:30','2010-01-21
21:39:01',null,'2014-08-12','9999-12-31','2013-07-20','2014-08-12','2000-03-12');
+ """
+
+ order_qt_select """
+ select window_funnel(4941185, "fixed", col_datetime_undef_signed,
+ col_date_undef_signed_not_null <
CAST(DATE_SUB(col_datetime_6__undef_signed_not_null, INTERVAL 2 HOUR) AS
DATETIME)) AS col_alias4750
+ from tbl_test_clone_legacy_nullable_from_nereids
+ """
+
+ sql """
+ drop table if exists tbl_test_clone_legacy_nullable_from_nereids force;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]