This is an automated email from the ASF dual-hosted git repository.

kxiao 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 fbc183bf1a2 [date](fix) modify push-down predicate for datev1 type 
(#25781)
fbc183bf1a2 is described below

commit fbc183bf1a2c6ddaa3881f425f9dd18e0f58f09a
Author: Gabriel <gabrielleeb...@gmail.com>
AuthorDate: Tue Oct 24 13:16:13 2023 +0800

    [date](fix) modify push-down predicate for datev1 type (#25781)
---
 be/src/exprs/bloom_filter_func.h                               |  5 -----
 be/src/vec/exec/scan/vscan_node.cpp                            |  6 ------
 .../rules/expression/rules/SimplifyComparisonPredicate.java    | 10 ----------
 .../expression/rules/SimplifyComparisonPredicateTest.java      |  8 --------
 4 files changed, 29 deletions(-)

diff --git a/be/src/exprs/bloom_filter_func.h b/be/src/exprs/bloom_filter_func.h
index 0a86a359902..330c939819c 100644
--- a/be/src/exprs/bloom_filter_func.h
+++ b/be/src/exprs/bloom_filter_func.h
@@ -434,11 +434,6 @@ struct DateFindOp : public 
CommonFindOp<vectorized::VecDateTimeValue> {
 
         vectorized::VecDateTimeValue date_value;
         date_value.from_olap_date(value);
-        // So confusing here. For join node with condition (a.date_col = 
b.date_col), the actual
-        // expression is CAST(a.date_col AS DATETIME) = CAST(b.date_col AS 
DATETIME). So we build
-        // this bloom filter by CAST(a.date_col AS DATETIME) and also need to 
probe this bloom
-        // filter by a datetime value.
-        date_value.set_type(TimeType::TIME_DATETIME);
 
         return bloom_filter.test(Slice((char*)&date_value, 
sizeof(vectorized::VecDateTimeValue)));
     }
diff --git a/be/src/vec/exec/scan/vscan_node.cpp 
b/be/src/vec/exec/scan/vscan_node.cpp
index 32bc5bbe88e..68e66231300 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -76,9 +76,6 @@ namespace doris::vectorized {
     }
 
 static bool ignore_cast(SlotDescriptor* slot, VExpr* expr) {
-    if (slot->type().is_date_type() && expr->type().is_date_type()) {
-        return true;
-    }
     if (slot->type().is_string_type() && expr->type().is_string_type()) {
         return true;
     }
@@ -86,9 +83,6 @@ static bool ignore_cast(SlotDescriptor* slot, VExpr* expr) {
         if (slot->type().children[0].type == expr->type().type) {
             return true;
         }
-        if (slot->type().children[0].is_date_type() && 
expr->type().is_date_type()) {
-            return true;
-        }
         if (slot->type().children[0].is_string_type() && 
expr->type().is_string_type()) {
             return true;
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
index 74627eae9f7..b1c54d82a74 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
@@ -188,16 +188,6 @@ public class SimplifyComparisonPredicate extends 
AbstractExpressionRewriteRule {
             }
         }
 
-        if (left.getDataType() == DateType.INSTANCE && right.getDataType() == 
DateType.INSTANCE) {
-            // Date cp Date is not supported in BE storage engine. So cast to 
DateTime
-            left = new Cast(left, DateTimeType.INSTANCE);
-            if (right instanceof DateLiteral) {
-                DateLiteral l = (DateLiteral) right;
-                right = new DateTimeLiteral(l.getYear(), l.getMonth(), 
l.getDay(), 0, 0, 0);
-            } else {
-                right = new Cast(right, DateTimeType.INSTANCE);
-            }
-        }
         if (left != cp.left() || right != cp.right()) {
             return cp.withChildren(left, right);
         } else {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java
index 6735e31192f..f76683338c4 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicateTest.java
@@ -28,7 +28,6 @@ import 
org.apache.doris.nereids.trees.expressions.literal.DateLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.DateTimeLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal;
 import org.apache.doris.nereids.trees.expressions.literal.DateV2Literal;
-import org.apache.doris.nereids.types.DateTimeType;
 import org.apache.doris.nereids.types.DateTimeV2Type;
 
 import com.google.common.collect.ImmutableList;
@@ -64,13 +63,6 @@ class SimplifyComparisonPredicateTest extends 
ExpressionRewriteTestHelper {
                 new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), 
dtv2),
                 new EqualTo(new Cast(dv2, DateTimeV2Type.SYSTEM_DEFAULT), 
dtv2));
 
-        // DateTimeV2 -> Date
-        assertRewrite(
-                new GreaterThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), 
dtv2),
-                new GreaterThan(new Cast(d, DateTimeType.INSTANCE), new 
DateTimeLiteral(1, 1, 1, 0, 0, 0)));
-        assertRewrite(
-                new LessThan(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2),
-                new LessThan(new Cast(d, DateTimeType.INSTANCE), new 
DateTimeLiteral(1, 1, 2, 0, 0, 0)));
         assertRewrite(
                 new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2),
                 new EqualTo(new Cast(d, DateTimeV2Type.SYSTEM_DEFAULT), dtv2));


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to