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 389afa17b70 branch-4.0: [fix](datetime)Require exact match in 
DateTimeV2Type.acceptsType #62201 (#62834)
389afa17b70 is described below

commit 389afa17b7076df9eb8282ccaee8a6f07051c8a5
Author: starocean999 <[email protected]>
AuthorDate: Sat May 9 15:57:29 2026 +0800

    branch-4.0: [fix](datetime)Require exact match in 
DateTimeV2Type.acceptsType #62201 (#62834)
    
    Cherry-picked from https://github.com/apache/doris/pull/62201
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../rules/SimplifyConditionalFunction.java         | 18 ++++++---
 .../expressions/functions/scalar/CreateMap.java    | 38 ++++++++++++++---
 .../apache/doris/nereids/types/DateTimeV2Type.java |  2 +-
 .../doris/nereids/util/TypeCoercionUtils.java      | 37 +----------------
 .../nereids/rules/expression/FoldConstantTest.java |  2 +-
 .../rules/SimplifyConditionalFunctionTest.java     | 17 +++++---
 .../functions/FieldDateTimeV2WildcardTest.java     | 47 ++++++++++++++++++++++
 .../simplify_conditional_function.out              |  6 +++
 .../jdbc/test_mysql_jdbc_catalog.groovy            |  4 +-
 .../simplify_conditional_function.groovy           | 47 ++++++++++++++++++++++
 10 files changed, 163 insertions(+), 55 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunction.java
index f4d0e479fd6..9a78ea59f86 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunction.java
@@ -84,22 +84,27 @@ public class SimplifyConditionalFunction implements 
ExpressionPatternRuleFactory
                     coalesce, new NullLiteral(coalesce.getDataType()), 
ctx.rewriteContext
             );
         } else {
-            return TypeCoercionUtils.ensureSameResultType(
-                    coalesce, coalesce.withChildren(newChildren), 
ctx.rewriteContext
-            );
+            if (1 == newChildren.size()) {
+                return TypeCoercionUtils.ensureSameResultType(coalesce, 
newChildren.get(0), ctx.rewriteContext);
+            } else {
+                return TypeCoercionUtils.ensureSameResultType(
+                        coalesce, coalesce.withChildren(newChildren), 
ctx.rewriteContext
+                );
+            }
         }
     }
 
     /*
     * nvl(null,R) => R
     * nvl(L(not-nullable ),R) => L
+    * nvl(L,null) => L
     * */
     private static Expression rewriteNvl(ExpressionMatchingContext<Nvl> ctx) {
         Nvl nvl = ctx.expr;
         if (nvl.child(0) instanceof NullLiteral) {
             return TypeCoercionUtils.ensureSameResultType(nvl, nvl.child(1), 
ctx.rewriteContext);
         }
-        if (!nvl.child(0).nullable()) {
+        if (!nvl.child(0).nullable() || nvl.child(1) instanceof NullLiteral) {
             return TypeCoercionUtils.ensureSameResultType(nvl, nvl.child(0), 
ctx.rewriteContext);
         }
         return nvl;
@@ -108,10 +113,13 @@ public class SimplifyConditionalFunction implements 
ExpressionPatternRuleFactory
     /*
     * nullif(null, R) => Null
     * nullif(L, null) => Null
+    * nullif(null, null) => Null
      */
     private static Expression rewriteNullIf(ExpressionMatchingContext<NullIf> 
ctx) {
         NullIf nullIf = ctx.expr;
-        if (nullIf.child(0) instanceof NullLiteral || nullIf.child(1) 
instanceof NullLiteral) {
+        if (nullIf.child(0) instanceof NullLiteral && nullIf.child(1) 
instanceof NullLiteral) {
+            return TypeCoercionUtils.ensureSameResultType(nullIf, 
nullIf.child(0), ctx.rewriteContext);
+        } else if (nullIf.child(0) instanceof NullLiteral || nullIf.child(1) 
instanceof NullLiteral) {
             return TypeCoercionUtils.ensureSameResultType(
                     nullIf, new Nullable(nullIf.child(0)), ctx.rewriteContext
             );
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CreateMap.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CreateMap.java
index eed1dbebce9..6bca4dbda42 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CreateMap.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CreateMap.java
@@ -22,13 +22,14 @@ import 
org.apache.doris.nereids.exceptions.AnalysisException;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
-import org.apache.doris.nereids.trees.expressions.functions.ExpressionTrait;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.ArrayType;
 import org.apache.doris.nereids.types.DataType;
 import org.apache.doris.nereids.types.MapType;
+import org.apache.doris.nereids.util.TypeCoercionUtils;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -109,12 +110,39 @@ public class CreateMap extends ScalarFunction
         if (arity() == 0) {
             return SIGNATURES;
         } else {
+            List<Expression> keys = Lists.newArrayList();
+            List<Expression> values = Lists.newArrayList();
+            for (int i = 0; i < arity(); i++) {
+                if (i % 2 == 0) {
+                    keys.add(child(i));
+                } else {
+                    values.add(child(i));
+                }
+            }
+            // TODO: use the find common type to get key and value type after 
we redefine type coercion in Doris.
+            Array keyArray = new Array(keys.toArray(new Expression[0]));
+            Array valueArray = new Array(values.toArray(new Expression[0]));
+            keyArray = (Array) 
TypeCoercionUtils.implicitCastInputTypes(keyArray, 
keyArray.expectedInputTypes());
+            valueArray = (Array) 
TypeCoercionUtils.implicitCastInputTypes(valueArray, 
valueArray.expectedInputTypes());
+            DataType keyType = ((ArrayType) 
(keyArray.getDataType())).getItemType();
+            DataType valueType = ((ArrayType) 
(valueArray.getDataType())).getItemType();
+            ImmutableList.Builder<DataType> childTypes = 
ImmutableList.builder();
+            for (int i = 0; i < arity(); i++) {
+                if (i % 2 == 0) {
+                    childTypes.add(keyType);
+                } else {
+                    childTypes.add(valueType);
+                }
+            }
             return ImmutableList.of(FunctionSignature.of(
                     getDataType(),
-                    children.stream()
-                            .map(ExpressionTrait::getDataType)
-                            .collect(ImmutableList.toImmutableList())
-            ));
+                    childTypes.build())
+            );
         }
     }
+
+    @Override
+    public FunctionSignature computeSignature(FunctionSignature signature) {
+        return signature;
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
index 286cae8ceb3..f56b4662f8b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/DateTimeV2Type.java
@@ -150,7 +150,7 @@ public class DateTimeV2Type extends DateLikeType implements 
ScaleTimeType {
 
     @Override
     public boolean acceptsType(DataType other) {
-        return other instanceof DateTimeV2Type;
+        return other.equals(this);
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
index 7e7460a12ea..5b93fe2a956 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
@@ -47,7 +47,6 @@ import 
org.apache.doris.nereids.trees.expressions.TimestampArithmetic;
 import org.apache.doris.nereids.trees.expressions.functions.BoundFunction;
 import org.apache.doris.nereids.trees.expressions.functions.FunctionBuilder;
 import 
org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeExtractAndTransform;
-import org.apache.doris.nereids.trees.expressions.functions.scalar.Array;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.CreateMap;
 import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral;
@@ -715,46 +714,14 @@ public class TypeCoercionUtils {
     public static Expression processBoundFunction(BoundFunction boundFunction) 
{
         // check
         boundFunction.checkLegalityBeforeTypeCoercion();
-
-        if (boundFunction instanceof CreateMap) {
-            return processCreateMap((CreateMap) boundFunction);
+        if (boundFunction instanceof CreateMap && boundFunction.arity() == 0) {
+            return new MapLiteral();
         }
 
         // type coercion
         return implicitCastInputTypes(boundFunction, 
boundFunction.expectedInputTypes());
     }
 
-    private static Expression processCreateMap(CreateMap createMap) {
-        if (createMap.arity() == 0) {
-            return new MapLiteral();
-        }
-        List<Expression> keys = Lists.newArrayList();
-        List<Expression> values = Lists.newArrayList();
-        for (int i = 0; i < createMap.arity(); i++) {
-            if (i % 2 == 0) {
-                keys.add(createMap.child(i));
-            } else {
-                values.add(createMap.child(i));
-            }
-        }
-        // TODO: use the find common type to get key and value type after we 
redefine type coercion in Doris.
-        Array keyArray = new Array(keys.toArray(new Expression[0]));
-        Array valueArray = new Array(values.toArray(new Expression[0]));
-        keyArray = (Array) implicitCastInputTypes(keyArray, 
keyArray.expectedInputTypes());
-        valueArray = (Array) implicitCastInputTypes(valueArray, 
valueArray.expectedInputTypes());
-        DataType keyType = ((ArrayType) 
(keyArray.getDataType())).getItemType();
-        DataType valueType = ((ArrayType) 
(valueArray.getDataType())).getItemType();
-        ImmutableList.Builder<Expression> newChildren = 
ImmutableList.builder();
-        for (int i = 0; i < createMap.arity(); i++) {
-            if (i % 2 == 0) {
-                newChildren.add(castIfNotSameType(createMap.child(i), 
keyType));
-            } else {
-                newChildren.add(castIfNotSameType(createMap.child(i), 
valueType));
-            }
-        }
-        return createMap.withChildren(newChildren.build());
-    }
-
     /**
      * process divide
      */
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java
index 4912ef840d6..e08b42a3b07 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java
@@ -1475,7 +1475,7 @@ class FoldConstantTest extends 
ExpressionRewriteTestHelper {
 
         assertRewriteExpression("nvl(NULL, 1)", "1");
         assertRewriteExpression("nvl(NULL, NULL)", "NULL");
-        assertRewriteAfterTypeCoercion("nvl(IA, NULL)", "ifnull(IA, NULL)");
+        assertRewriteAfterTypeCoercion("nvl(IA, NULL)", "IA");
         assertRewriteAfterTypeCoercion("nvl(IA, 1)", "ifnull(IA, 1)");
 
         Expression foldNvl = executor.rewrite(
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunctionTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunctionTest.java
index 7808823d36c..532f0f36c94 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunctionTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConditionalFunctionTest.java
@@ -78,11 +78,6 @@ public class SimplifyConditionalFunctionTest extends 
ExpressionRewriteTestHelper
                 new Coalesce(new NullLiteral(DateTimeV2Type.of(6)), 
datetimeSlot),
                 new Cast(datetimeSlot, DateTimeV2Type.of(6))
         );
-        // coalesce(non-nullable_slot_datetime(6), null_datetime(0))
-        assertRewrite(
-                new Coalesce(datetimeSlot, new 
NullLiteral(DateTimeV2Type.of(6))),
-                new Cast(datetimeSlot, DateTimeV2Type.of(6))
-        );
     }
 
     @Test
@@ -99,6 +94,9 @@ public class SimplifyConditionalFunctionTest extends 
ExpressionRewriteTestHelper
         // nvl(nullable_slot, nullable_slot) -> nvl(nullable_slot, 
nullable_slot)
         assertRewrite(new Nvl(slot, nonNullableSlot), new Nvl(slot, 
nonNullableSlot));
 
+        // nvl(nullable_slot, null) -> nullable_slot
+        assertRewrite(new Nvl(slot, NullLiteral.INSTANCE), slot);
+
         // nvl(non-nullable_slot, null) -> non-nullable_slot
         assertRewrite(new Nvl(nonNullableSlot, NullLiteral.INSTANCE), 
nonNullableSlot);
 
@@ -133,13 +131,20 @@ public class SimplifyConditionalFunctionTest extends 
ExpressionRewriteTestHelper
         // nullif(non-nullable_slot, null) -> non-nullable_slot
         assertRewrite(new NullIf(nonNullableSlot, NullLiteral.INSTANCE), new 
Nullable(nonNullableSlot));
 
+        SlotReference datetimeSlot = new SlotReference("dt", 
DateTimeV2Type.of(0), false);
+        // nullif(datetime_slot, null_datetime(6)) -> 
nullable(cast(datetime_slot to dt(6)))
+        assertRewrite(
+                new NullIf(datetimeSlot, new 
NullLiteral(DateTimeV2Type.of(6))),
+                new Nullable(new Cast(datetimeSlot, DateTimeV2Type.of(6)))
+        );
+
         // nullif(null_datetime(0), null_datetime(6)) -> null_datetime(6)
         assertRewrite(
                 new NullIf(
                         new NullLiteral(DateTimeV2Type.of(0)),
                         new NullLiteral(DateTimeV2Type.of(6))
                 ),
-                new Cast(new Nullable(new NullLiteral(DateTimeV2Type.of(0))), 
DateTimeV2Type.of(6))
+                new NullLiteral(DateTimeV2Type.of(6))
         );
     }
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/FieldDateTimeV2WildcardTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/FieldDateTimeV2WildcardTest.java
new file mode 100644
index 00000000000..282f368976e
--- /dev/null
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/FieldDateTimeV2WildcardTest.java
@@ -0,0 +1,47 @@
+// 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.
+
+package org.apache.doris.nereids.trees.expressions.functions;
+
+import org.apache.doris.catalog.FunctionSignature;
+import org.apache.doris.nereids.trees.expressions.functions.scalar.Field;
+import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal;
+import org.apache.doris.nereids.types.DateTimeV2Type;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Regression test for DateTimeV2Type wildcard/MAX handling in function 
signatures.
+ */
+public class FieldDateTimeV2WildcardTest {
+
+    @Test
+    public void testFieldDateTimeV2WildcardPromotion() {
+        // Create literals with different datetimev2 precisions
+        DateTimeV2Literal search = new DateTimeV2Literal("2020-02-02 
00:00:00.123"); // scale 3
+        DateTimeV2Literal v1 = new DateTimeV2Literal("2020-02-02 
00:00:00.12"); // scale 2
+        DateTimeV2Literal v2 = new DateTimeV2Literal("2020-02-02 00:00:00.1"); 
// scale 1
+
+        Field field = new Field(search, v1, v2);
+        FunctionSignature signature = field.getSignature();
+
+        // The final promoted precision should be max(3,2,1) -> 3
+        Assertions.assertEquals(DateTimeV2Type.of(3), signature.getArgType(0));
+        Assertions.assertEquals(DateTimeV2Type.of(3), 
signature.getVarArgType().get());
+    }
+}
diff --git 
a/regression-test/data/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.out
 
b/regression-test/data/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.out
index 70b4975e912..c27bd380055 100644
--- 
a/regression-test/data/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.out
+++ 
b/regression-test/data/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.out
@@ -134,3 +134,9 @@ abc
 -- !test_nullable_nullif --
 1      1
 
+-- !test_coalesce_custom --
+2012-02-02T01:02:03    2010-01-01T00:00
+2016-06-06T06:06:06    2000-01-01T00:00
+2019-09-09T09:09:09    2012-12-12T12:12:12
+2020-08-08T08:08:08    2015-05-05T05:05:05
+
diff --git 
a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy 
b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy
index 2235c4b016a..4adc5c9e280 100644
--- 
a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy
+++ 
b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy
@@ -396,12 +396,12 @@ suite("test_mysql_jdbc_catalog", 
"p0,external,mysql,external_docker,external_doc
         explain {
             sql ("select k6, k8 from test1 where nvl(k6, null) = 1;")
 
-            contains "QUERY: SELECT `k6`, `k8` FROM `doris_test`.`test1` WHERE 
((ifnull(`k6`, NULL) = 1))"
+            contains "QUERY: SELECT `k6`, `k8` FROM `doris_test`.`test1` WHERE 
((`k6` = 1))"
         }
         explain {
             sql ("select k6, k8 from test1 where nvl(nvl(k6, null),null) = 1;")
 
-            contains "QUERY: SELECT `k6`, `k8` FROM `doris_test`.`test1` WHERE 
((ifnull(ifnull(`k6`, NULL), NULL) = 1))"
+            contains "QUERY: SELECT `k6`, `k8` FROM `doris_test`.`test1` WHERE 
((`k6` = 1))"
         }
         sql """ set enable_ext_func_pred_pushdown = "false"; """
         explain {
diff --git 
a/regression-test/suites/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.groovy
 
b/regression-test/suites/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.groovy
index 2b99ad0a23a..8f0e7eba89e 100644
--- 
a/regression-test/suites/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/simplify_conditional_function/simplify_conditional_function.groovy
@@ -51,4 +51,51 @@ suite("simplify_conditional_function") {
     qt_test_outer_ref_nullif "select c1 from (select nullif(a, null) c1,c from 
test_simplify_conditional_function order by c1,c limit 2 ) t group by c1 order 
by c1"
 
     qt_test_nullable_nullif "SELECT COUNT( DISTINCT NULLIF ( 1, NULL ) ), 
COUNT( DISTINCT 72 )"
+
+    sql "drop table if exists 
table_20_30_utf8_partitions2_keys3_properties4_distributed_by5"
+    sql """create table 
table_20_30_utf8_partitions2_keys3_properties4_distributed_by5 (
+        pk int,
+        col_varchar_64__undef_signed_not_null varchar(64),
+        col_date_undef_signed_not_null date,
+        col_datetime_3__undef_signed_not_null datetime(3),
+        col_datetime_0__undef_signed datetime(0)
+    ) distributed by hash(pk) properties("replication_num"="1");"""
+
+    sql """drop table if exists 
table_24_50_utf8_partitions2_keys3_properties4_distributed_by5"""
+    sql """create table 
table_24_50_utf8_partitions2_keys3_properties4_distributed_by5 (
+        pk int,
+        col_varchar_64__undef_signed varchar(64),
+        col_datetime_6__undef_signed_not_null datetime(6),
+        col_datetime_0__undef_signed datetime(0)
+    ) distributed by hash(pk) properties("replication_num"="1");"""
+
+    sql """insert into 
table_20_30_utf8_partitions2_keys3_properties4_distributed_by5 values
+        (1,'k1','2012-01-01','2012-02-02 01:02:03', '2010-01-01 00:00:00'),
+        (2,'k2','2015-06-01', null, '2011-01-01 00:00:00'),
+        (3,'k3','2010-03-03','2010-04-04 04:04:04','2009-01-01 00:00:00'),
+        (4,'k4','2018-12-12', null, null),
+        (5,'k5','2020-07-07','2020-08-08 08:08:08','2015-05-05 05:05:05')"""
+
+    sql """insert into 
table_24_50_utf8_partitions2_keys3_properties4_distributed_by5 values
+        (101,'k1','2011-11-11 11:11:11', null),
+        (102,'k2','2016-06-06 06:06:06','2000-01-01 00:00:00'),
+        (103,'kx','2009-09-09 09:09:09', null),
+        (104,'k4','2019-09-09 09:09:09','2012-12-12 12:12:12'),
+        (105,'zz','2021-01-01 01:01:01', null)"""
+
+    qt_test_coalesce_custom """
+    select
+            coalesce(
+                    t1.col_datetime_3__undef_signed_not_null,
+                    t2.col_datetime_6__undef_signed_not_null
+            ),
+            coalesce(t2.col_datetime_0__undef_signed, 
t1.col_datetime_0__undef_signed)
+    from
+            (select * from 
table_20_30_utf8_partitions2_keys3_properties4_distributed_by5) as t1
+    left join
+            table_24_50_utf8_partitions2_keys3_properties4_distributed_by5 as 
t2
+            on t1.col_varchar_64__undef_signed_not_null = 
t2.col_varchar_64__undef_signed
+    where t1.col_date_undef_signed_not_null > '2011-05-12'
+    order by t1.pk nulls last, t2.pk nulls last
+    limit 8"""
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to