This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 5216f3bf606 [Bug](datev2) fix wrong result of predicate about
cast(cast(datetimev2 as datev2) as datetimev2) #53485 (#53514)
5216f3bf606 is described below
commit 5216f3bf60663d1151fb529bd4d78327199c2418
Author: Pxl <[email protected]>
AuthorDate: Tue Jul 22 18:11:12 2025 +0800
[Bug](datev2) fix wrong result of predicate about cast(cast(datetimev2 as
datev2) as datetimev2) #53485 (#53514)
pick fom #53485
---
be/src/pipeline/exec/scan_operator.cpp | 3 +-
regression-test/data/cast_p0/cast_ignore.out | Bin 0 -> 151 bytes
regression-test/suites/cast_p0/cast_ignore.groovy | 35 ++++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/be/src/pipeline/exec/scan_operator.cpp
b/be/src/pipeline/exec/scan_operator.cpp
index 591ea01dfb9..dfd78ab59e1 100644
--- a/be/src/pipeline/exec/scan_operator.cpp
+++ b/be/src/pipeline/exec/scan_operator.cpp
@@ -518,7 +518,8 @@ bool ScanLocalState<Derived>::_is_predicate_acting_on_slot(
// the type of predicate not match the slot's type
return false;
}
- } else if (child_contains_slot->type().is_datetime_type() &&
+ } else if ((child_contains_slot->type().is_datetime_type() ||
+ child_contains_slot->type().is_datetime_v2_type()) &&
child_contains_slot->node_type() ==
doris::TExprNodeType::CAST_EXPR) {
// Expr `CAST(CAST(datetime_col AS DATE) AS DATETIME) =
datetime_literal` should not be
// push down.
diff --git a/regression-test/data/cast_p0/cast_ignore.out
b/regression-test/data/cast_p0/cast_ignore.out
new file mode 100644
index 00000000000..ef9a4ecb109
Binary files /dev/null and b/regression-test/data/cast_p0/cast_ignore.out differ
diff --git a/regression-test/suites/cast_p0/cast_ignore.groovy
b/regression-test/suites/cast_p0/cast_ignore.groovy
new file mode 100644
index 00000000000..261b44c1164
--- /dev/null
+++ b/regression-test/suites/cast_p0/cast_ignore.groovy
@@ -0,0 +1,35 @@
+// 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("cast_ignore") {
+ sql "drop table if exists tdate"
+ sql """
+ create table tdate(
+ k1 int,
+ kdate date,
+ kdatetime datetime
+) distributed by hash (k1) buckets 1
+properties ("replication_num"="1");
+ """
+ sql """
+insert into tdate values(1,'2023-10-01','2023-10-01 01:00:00'),
+(2,'2023-10-02','2023-10-02 01:00:00'),
+(3,'2023-10-03','2023-10-03 01:00:00');
+"""
+ qt_test "select k1,kdate,kdatetime from tdate where cast(cast(kdatetime as
date) as datetime)='2023-10-01';"
+ qt_test "select k1,kdate,kdatetime from tdate where
kdatetime='2023-10-01';"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]