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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new da284e0764c branch-3.0: [enhancement](maxcompute)support maxcompute 
timestamp column type. #48768 (#48841)
da284e0764c is described below

commit da284e0764c1b023875949048c336ea6370c47f4
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Mar 19 22:08:34 2025 +0800

    branch-3.0: [enhancement](maxcompute)support maxcompute timestamp column 
type. #48768 (#48841)
    
    Cherry-picked from #48768
    
    Co-authored-by: daidai <[email protected]>
---
 .../doris/maxcompute/MaxComputeColumnValue.java    |  12 +-
 .../maxcompute/MaxComputeExternalCatalog.java      |  10 +-
 .../maxcompute/MaxComputeExternalTable.java        |   1 +
 .../maxcompute/source/MaxComputeScanNode.java      |  43 +++-
 .../property/constants/MCProperties.java           |   4 +
 .../maxcompute/test_max_compute_timestamp.out      | Bin 0 -> 3944 bytes
 .../maxcompute/test_max_compute_timestamp.groovy   | 216 +++++++++++++++++++++
 7 files changed, 274 insertions(+), 12 deletions(-)

diff --git 
a/fe/be-java-extensions/max-compute-scanner/src/main/java/org/apache/doris/maxcompute/MaxComputeColumnValue.java
 
b/fe/be-java-extensions/max-compute-scanner/src/main/java/org/apache/doris/maxcompute/MaxComputeColumnValue.java
index fb29cb89fa8..5a49395780e 100644
--- 
a/fe/be-java-extensions/max-compute-scanner/src/main/java/org/apache/doris/maxcompute/MaxComputeColumnValue.java
+++ 
b/fe/be-java-extensions/max-compute-scanner/src/main/java/org/apache/doris/maxcompute/MaxComputeColumnValue.java
@@ -30,6 +30,7 @@ import org.apache.arrow.vector.Float8Vector;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.SmallIntVector;
 import org.apache.arrow.vector.TimeStampMilliTZVector;
+import org.apache.arrow.vector.TimeStampNanoTZVector;
 import org.apache.arrow.vector.TimeStampNanoVector;
 import org.apache.arrow.vector.TinyIntVector;
 import org.apache.arrow.vector.ValueVector;
@@ -233,15 +234,17 @@ public class MaxComputeColumnValue implements ColumnValue 
{
         LocalDateTime result;
 
         ArrowType.Timestamp timestampType = ( ArrowType.Timestamp) 
column.getField().getFieldType().getType();
-        if (timestampType.getUnit() ==  
org.apache.arrow.vector.types.TimeUnit.MILLISECOND) {
+        if (timestampType.getUnit() == 
org.apache.arrow.vector.types.TimeUnit.MILLISECOND) { //DATETIME
             result = convertToLocalDateTime((TimeStampMilliTZVector) column, 
idx);
-        } else {
+        } else if (timestampType.getTimezone() == null) { // TIMESTAMP_NTZ
             NullableTimeStampNanoHolder valueHoder = new 
NullableTimeStampNanoHolder();
             ((TimeStampNanoVector) column).get(idx, valueHoder);
             long timestampNanos = valueHoder.value;
 
             result = LocalDateTime.ofEpochSecond(timestampNanos / 
1_000_000_000,
                     (int) (timestampNanos % 1_000_000_000), 
java.time.ZoneOffset.UTC);
+        } else { // TIMESTAMP
+            result = convertToLocalDateTime((TimeStampNanoTZVector) column, 
idx);
         }
 
         /*
@@ -330,4 +333,9 @@ public class MaxComputeColumnValue implements ColumnValue {
         return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestampMillis), 
timeZone);
     }
 
+    public LocalDateTime convertToLocalDateTime(TimeStampNanoTZVector 
nanoTZVector, int index) {
+        long timestampNano = nanoTZVector.get(index);
+        return Instant.ofEpochSecond(timestampNano / 1_000_000_000, 
timestampNano % 1_000_000_000)
+                .atZone(timeZone).toLocalDateTime();
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
index 27e4976aedd..1c8979ee1db 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalCatalog.java
@@ -76,6 +76,8 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
     private int readTimeout;
     private int retryTimes;
 
+    public boolean dateTimePredicatePushDown;
+
     private static final Map<String, ZoneId> REGION_ZONE_MAP;
     private static final List<String> REQUIRED_PROPERTIES = ImmutableList.of(
             MCProperties.PROJECT,
@@ -201,7 +203,9 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
         accessKey = credential.getAccessKey();
         secretKey = credential.getSecretKey();
 
-
+        dateTimePredicatePushDown = Boolean.parseBoolean(
+                props.getOrDefault(MCProperties.DATETIME_PREDICATE_PUSH_DOWN,
+                        MCProperties.DEFAULT_DATETIME_PREDICATE_PUSH_DOWN));
 
         Account account = new AliyunAccount(accessKey, secretKey);
         this.odps = new Odps(account);
@@ -338,6 +342,10 @@ public class MaxComputeExternalCatalog extends 
ExternalCatalog {
         return readTimeout;
     }
 
+    public boolean getDateTimePredicatePushDown() {
+        return dateTimePredicatePushDown;
+    }
+
     public ZoneId getProjectDateTimeZone() {
         makeSureInitialized();
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
index 7f626655442..1136fb079f3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/MaxComputeExternalTable.java
@@ -269,6 +269,7 @@ public class MaxComputeExternalTable extends ExternalTable {
             case DATETIME: {
                 return ScalarType.createDatetimeV2Type(3);
             }
+            case TIMESTAMP:
             case TIMESTAMP_NTZ: {
                 return ScalarType.createDatetimeV2Type(6);
             }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
index e4bb8b5e9dc..9235c237134 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/maxcompute/source/MaxComputeScanNode.java
@@ -88,6 +88,8 @@ import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 public class MaxComputeScanNode extends FileQueryScanNode {
+    static final DateTimeFormatter dateTime3Formatter = 
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
+    static final DateTimeFormatter dateTime6Formatter = 
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
 
     private final MaxComputeExternalTable table;
     private Predicate filterPredicate;
@@ -492,16 +494,40 @@ public class MaxComputeScanNode extends FileQueryScanNode 
{
                 return  " \"" + dateLiteral.getStringValue(dstType) + "\" ";
             }
             case DATETIME: {
-                DateLiteral dateLiteral = (DateLiteral) literalExpr;
-                ScalarType dstType = ScalarType.createDatetimeV2Type(3);
+                MaxComputeExternalCatalog  mcCatalog = 
(MaxComputeExternalCatalog) table.getCatalog();
+                if (mcCatalog.getDateTimePredicatePushDown()) {
+                    DateLiteral dateLiteral = (DateLiteral) literalExpr;
+                    ScalarType dstType = ScalarType.createDatetimeV2Type(3);
 
-                return  " \"" + 
convertDateTimezone(dateLiteral.getStringValue(dstType),
-                                    ((MaxComputeExternalCatalog) 
table.getCatalog()).getProjectDateTimeZone()) + "\" ";
+                    return " \"" + 
convertDateTimezone(dateLiteral.getStringValue(dstType), dateTime3Formatter,
+                            ZoneId.of("UTC")) + "\" ";
+                }
+                break;
+            }
+            /**
+             * Disable the predicate pushdown to the odps API because the 
timestamp precision of odps is 9 and the
+             * mapping precision of Doris is 6. If we insert `2023-02-02 
00:00:00.123456789` into odps, doris reads
+             * it as `2023-02-02 00:00:00.123456`. Since "789" is missing, we 
cannot push it down correctly.
+             */
+            case TIMESTAMP: {
+                MaxComputeExternalCatalog  mcCatalog = 
(MaxComputeExternalCatalog) table.getCatalog();
+                if (mcCatalog.getDateTimePredicatePushDown()) {
+                    DateLiteral dateLiteral = (DateLiteral) literalExpr;
+                    ScalarType dstType = ScalarType.createDatetimeV2Type(6);
+
+                    return  " \"" + 
convertDateTimezone(dateLiteral.getStringValue(dstType), dateTime6Formatter,
+                            ZoneId.of("UTC")) + "\" ";
+                }
+                break;
             }
             case TIMESTAMP_NTZ: {
-                DateLiteral dateLiteral = (DateLiteral) literalExpr;
-                ScalarType dstType = ScalarType.createDatetimeV2Type(6);
-                return  " \"" + dateLiteral.getStringValue(dstType) + "\" ";
+                MaxComputeExternalCatalog  mcCatalog = 
(MaxComputeExternalCatalog) table.getCatalog();
+                if (mcCatalog.getDateTimePredicatePushDown()) {
+                    DateLiteral dateLiteral = (DateLiteral) literalExpr;
+                    ScalarType dstType = ScalarType.createDatetimeV2Type(6);
+                    return " \"" + dateLiteral.getStringValue(dstType) + "\" ";
+                }
+                break;
             }
             default: {
                 break;
@@ -511,12 +537,11 @@ public class MaxComputeScanNode extends FileQueryScanNode 
{
     }
 
 
-    public static String convertDateTimezone(String dateTimeStr, ZoneId 
toZone) {
+    public static String convertDateTimezone(String dateTimeStr, 
DateTimeFormatter formatter, ZoneId toZone) {
         if (DateUtils.getTimeZone().equals(toZone)) {
             return dateTimeStr;
         }
 
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd 
HH:mm:ss.SSS");
         LocalDateTime localDateTime = LocalDateTime.parse(dateTimeStr, 
formatter);
 
         ZonedDateTime sourceZonedDateTime = 
localDateTime.atZone(DateUtils.getTimeZone());
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
index 3957ffc91bb..8282134c5a1 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/property/constants/MCProperties.java
@@ -71,6 +71,10 @@ public class MCProperties extends BaseProperties {
     public static final String SPLIT_CROSS_PARTITION = 
"mc.split_cross_partition";
     public static final String DEFAULT_SPLIT_CROSS_PARTITION = "true";
 
+    public static final String DATETIME_PREDICATE_PUSH_DOWN =
+            "mc.datetime_predicate_push_down";
+    public static final String DEFAULT_DATETIME_PREDICATE_PUSH_DOWN = "true";
+
     public static CloudCredential getCredential(Map<String, String> props) {
         return getCloudCredential(props, ACCESS_KEY, SECRET_KEY, 
SESSION_TOKEN);
     }
diff --git 
a/regression-test/data/external_table_p2/maxcompute/test_max_compute_timestamp.out
 
b/regression-test/data/external_table_p2/maxcompute/test_max_compute_timestamp.out
new file mode 100644
index 00000000000..125148aabc6
Binary files /dev/null and 
b/regression-test/data/external_table_p2/maxcompute/test_max_compute_timestamp.out
 differ
diff --git 
a/regression-test/suites/external_table_p2/maxcompute/test_max_compute_timestamp.groovy
 
b/regression-test/suites/external_table_p2/maxcompute/test_max_compute_timestamp.groovy
new file mode 100644
index 00000000000..c7e8d7d035c
--- /dev/null
+++ 
b/regression-test/suites/external_table_p2/maxcompute/test_max_compute_timestamp.groovy
@@ -0,0 +1,216 @@
+// 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.
+
+
+
+/*
+
+
+drop table if EXISTS datetime_tb1;
+CREATE TABLE datetime_tb1  (col1 datetime);
+INSERT INTO TABLE datetime_tb1 VALUES(datetime "2023-02-02 00:00:00");
+
+drop table if EXISTS timestamp_tb1;
+CREATE TABLE timestamp_tb1  (col1 TIMESTAMP,col2 TIMESTAMP_NTZ);
+INSERT INTO TABLE timestamp_tb1 VALUES(timestamp "2023-02-02 
00:00:00.123456789", timestamp_ntz "2023-02-02 00:00:00.123456789");
+
+drop table if EXISTS timestamp_tb2;
+CREATE TABLE  timestamp_tb2  (col1 TIMESTAMP,col2 TIMESTAMP_NTZ);
+INSERT INTO TABLE timestamp_tb2 VALUES(timestamp "2023-02-02 00:00:00.123456", 
timestamp_ntz "2023-02-02 00:00:00.123456" );
+*/
+
+suite("test_max_compute_timestamp", 
"p2,external,maxcompute,external_remote,external_remote_maxcompute") {
+
+
+    String enabled = context.config.otherConfigs.get("enableMaxComputeTest")
+    if (enabled != null && enabled.equalsIgnoreCase("true")) {
+        String ak = context.config.otherConfigs.get("ak")
+        String sk = context.config.otherConfigs.get("sk");
+        String mc_db = "mc_datalake"
+        String mc_catalog_name = "test_max_compute_timestamp"
+
+        sql """drop catalog if exists ${mc_catalog_name};"""
+        sql """
+            create catalog if not exists ${mc_catalog_name} properties (
+                "type" = "max_compute",
+                "mc.default.project" = "${mc_db}",
+                "mc.access_key" = "${ak}",
+                "mc.secret_key" = "${sk}",
+                "mc.endpoint" = 
"http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api";,
+                "mc.datetime_predicate_push_down" = "false"
+            );
+        """
+        sql """ switch ${mc_catalog_name} """
+        sql """ use ${mc_db}"""
+
+        sql """ set time_zone = "Asia/Shanghai" """
+        qt_1_1 """ select * from datetime_tb1;"""
+        qt_1_2 """ select * from datetime_tb1 where col1 > "2023-02-02 
00:00:00.000";"""
+        qt_1_3 """ select * from datetime_tb1 where col1 >= "2023-02-02 
00:00:00.000";"""
+        qt_1_4 """ select * from datetime_tb1 where col1 = "2023-02-02 
00:00:00.000";"""
+        qt_1_5 """ select * from datetime_tb1 where col1 <= "2023-02-02 
00:00:00.000";"""
+        qt_1_6 """ select * from datetime_tb1 where col1 < "2023-02-02 
00:00:00.000";"""
+        qt_1_7 """ select * from datetime_tb1 where col1 != "2023-02-02 
00:00:00.000";"""
+
+
+        qt_2_1 """select * from timestamp_tb1;"""
+        qt_2_2 """select * from timestamp_tb1 where col1 > "2023-02-02 
00:00:00.123456";"""
+        qt_2_3 """select * from timestamp_tb1 where col1 >= "2023-02-02 
00:00:00.123456";"""
+        qt_2_4 """select * from timestamp_tb1 where col1 = "2023-02-02 
00:00:00.123456";"""
+        qt_2_5 """select * from timestamp_tb1 where col1 <= "2023-02-02 
00:00:00.123456";"""
+        qt_2_6 """select * from timestamp_tb1 where col1 < "2023-02-02 
00:00:00.123456";"""
+        qt_2_7 """select * from timestamp_tb1 where col1 != "2023-02-02 
00:00:00.123456"; """
+        
+        qt_2_8 """ select * from timestamp_tb1 where col2 > "2023-02-02 
00:00:00.123456"; """ 
+        qt_2_9 """ select * from timestamp_tb1 where col2 >= "2023-02-02 
00:00:00.123456"; """ 
+        qt_2_10 """ select * from timestamp_tb1 where col2 = "2023-02-02 
00:00:00.123456"; """ 
+        qt_2_11 """ select * from timestamp_tb1 where col2 <= "2023-02-02 
00:00:00.123456"; """ 
+        qt_2_12 """ select * from timestamp_tb1 where col2 < "2023-02-02 
00:00:00.123456"; """ 
+        qt_2_13 """ select * from timestamp_tb1 where col2 != "2023-02-02 
00:00:00.123456"; """ 
+
+
+
+        qt_3_1 """ select * from timestamp_tb2;"""
+        qt_3_2 """ select * from timestamp_tb2 where col1 > "2023-02-02 
00:00:00.123456";"""
+        qt_3_3 """ select * from timestamp_tb2 where col1 >= "2023-02-02 
00:00:00.123456";"""
+        qt_3_4 """ select * from timestamp_tb2 where col1 = "2023-02-02 
00:00:00.123456";"""
+        qt_3_5 """ select * from timestamp_tb2 where col1 <= "2023-02-02 
00:00:00.123456";"""
+        qt_3_6 """ select * from timestamp_tb2 where col1 < "2023-02-02 
00:00:00.123456";"""
+        qt_3_7 """ select * from timestamp_tb2 where col1 != "2023-02-02 
00:00:00.123456";"""
+        qt_3_8 """ select * from timestamp_tb2 where col2 > "2023-02-02 
00:00:00.123456";"""
+        qt_3_9 """ select * from timestamp_tb2 where col2 >= "2023-02-02 
00:00:00.123456";"""
+        qt_3_10 """ select * from timestamp_tb2 where col2 = "2023-02-02 
00:00:00.123456";"""
+        qt_3_11 """ select * from timestamp_tb2 where col2 <= "2023-02-02 
00:00:00.123456";"""
+        qt_3_12 """ select * from timestamp_tb2 where col2 < "2023-02-02 
00:00:00.123456";"""
+        qt_3_13 """ select * from timestamp_tb2 where col2 != "2023-02-02 
00:00:00.123456";"""
+
+
+        sql """ set time_zone = "UTC" """
+
+        qt_4_1 """ select * from datetime_tb1;"""
+        qt_4_2 """ select * from datetime_tb1 where col1 > "2023-02-01 
16:00:00.000";"""
+        qt_4_3 """ select * from datetime_tb1 where col1 >= "2023-02-01 
16:00:00.000";"""
+        qt_4_4 """ select * from datetime_tb1 where col1 = "2023-02-01 
16:00:00.000";"""
+        qt_4_5 """ select * from datetime_tb1 where col1 <= "2023-02-01 
16:00:00.000";"""
+        qt_4_6 """ select * from datetime_tb1 where col1 < "2023-02-01 
16:00:00.000";"""
+        qt_4_7 """ select * from datetime_tb1 where col1 != "2023-02-01 
16:00:00.000";"""
+
+
+        qt_5_1 """select * from timestamp_tb1;"""
+        qt_5_2 """select * from timestamp_tb1 where col1 > "2023-02-01 
16:00:00.123456";"""
+        qt_5_3 """select * from timestamp_tb1 where col1 >= "2023-02-01 
16:00:00.123456";"""
+        qt_5_4 """select * from timestamp_tb1 where col1 = "2023-02-01 
16:00:00.123456";"""
+        qt_5_5 """select * from timestamp_tb1 where col1 <= "2023-02-01 
16:00:00.123456";"""
+        qt_5_6 """select * from timestamp_tb1 where col1 < "2023-02-01 
16:00:00.123456";"""
+        qt_5_7 """select * from timestamp_tb1 where col1 != "2023-02-01 
16:00:00.123456"; """
+        
+        qt_5_8 """ select * from timestamp_tb1 where col2 > "2023-02-02 
00:00:00.123456"; """ 
+        qt_5_9 """ select * from timestamp_tb1 where col2 >= "2023-02-02 
00:00:00.123456"; """ 
+        qt_5_10 """ select * from timestamp_tb1 where col2 = "2023-02-02 
00:00:00.123456"; """ 
+        qt_5_11 """ select * from timestamp_tb1 where col2 <= "2023-02-02 
00:00:00.123456"; """ 
+        qt_5_12 """ select * from timestamp_tb1 where col2 < "2023-02-02 
00:00:00.123456"; """ 
+        qt_5_13 """ select * from timestamp_tb1 where col2 != "2023-02-02 
00:00:00.123456"; """ 
+
+        
+        
+
+
+        qt_6_1 """ select * from timestamp_tb2;"""
+        qt_6_2 """ select * from timestamp_tb2 where col1 > "2023-02-01 
16:00:00.123456";"""
+        qt_6_3 """ select * from timestamp_tb2 where col1 >= "2023-02-01 
16:00:00.123456";"""
+        qt_6_4 """ select * from timestamp_tb2 where col1 = "2023-02-01 
16:00:00.123456";"""
+        qt_6_5 """ select * from timestamp_tb2 where col1 <= "2023-02-01 
16:00:00.123456";"""
+        qt_6_6 """ select * from timestamp_tb2 where col1 < "2023-02-01 
16:00:00.123456";"""
+        qt_6_7 """ select * from timestamp_tb2 where col1 != "2023-02-01 
16:00:00.123456";"""
+    
+        qt_6_8 """ select * from timestamp_tb1 where col2 > "2023-02-02 
00:00:00.123456"; """ 
+        qt_6_9 """ select * from timestamp_tb1 where col2 >= "2023-02-02 
00:00:00.123456"; """ 
+        qt_6_10 """ select * from timestamp_tb1 where col2 = "2023-02-02 
00:00:00.123456"; """ 
+        qt_6_11 """ select * from timestamp_tb1 where col2 <= "2023-02-02 
00:00:00.123456"; """ 
+        qt_6_12 """ select * from timestamp_tb1 where col2 < "2023-02-02 
00:00:00.123456"; """ 
+        qt_6_13 """ select * from timestamp_tb1 where col2 != "2023-02-02 
00:00:00.123456"; """ 
+
+        
+
+        sql """drop catalog if exists ${mc_catalog_name}_2;"""
+        sql """
+            create catalog if not exists ${mc_catalog_name}_2 properties (
+                "type" = "max_compute",
+                "mc.default.project" = "${mc_db}",
+                "mc.access_key" = "${ak}",
+                "mc.secret_key" = "${sk}",
+                "mc.endpoint" = 
"http://service.cn-beijing-vpc.maxcompute.aliyun-inc.com/api";,
+                "mc.datetime_predicate_push_down" = "true"
+            );
+        """
+        sql """ switch ${mc_catalog_name}_2 """
+        sql """ use ${mc_db}"""
+
+
+        sql """ set time_zone = "Asia/Shanghai" """
+        qt_7_1 """ select * from datetime_tb1;"""
+        qt_7_2 """ select * from datetime_tb1 where col1 > "2023-02-02 
00:00:00.000";"""
+        qt_7_3 """ select * from datetime_tb1 where col1 >= "2023-02-02 
00:00:00.000";"""
+        qt_7_4 """ select * from datetime_tb1 where col1 = "2023-02-02 
00:00:00.000";"""
+        qt_7_5 """ select * from datetime_tb1 where col1 <= "2023-02-02 
00:00:00.000";"""
+        qt_7_6 """ select * from datetime_tb1 where col1 < "2023-02-02 
00:00:00.000";"""
+        qt_7_7 """ select * from datetime_tb1 where col1 != "2023-02-02 
00:00:00.000";"""
+
+
+        qt_8_1 """ select * from timestamp_tb2;"""
+        qt_8_2 """ select * from timestamp_tb2 where col1 > "2023-02-02 
00:00:00.123456";"""
+        qt_8_3 """ select * from timestamp_tb2 where col1 >= "2023-02-02 
00:00:00.123456";"""
+        qt_8_4 """ select * from timestamp_tb2 where col1 = "2023-02-02 
00:00:00.123456";"""
+        qt_8_5 """ select * from timestamp_tb2 where col1 <= "2023-02-02 
00:00:00.123456";"""
+        qt_8_6 """ select * from timestamp_tb2 where col1 < "2023-02-02 
00:00:00.123456";"""
+        qt_8_7 """ select * from timestamp_tb2 where col1 != "2023-02-02 
00:00:00.123456";"""
+        qt_8_8 """ select * from timestamp_tb2 where col2 > "2023-02-02 
00:00:00.123456";"""
+        qt_8_9 """ select * from timestamp_tb2 where col2 >= "2023-02-02 
00:00:00.123456";"""
+        qt_8_10 """ select * from timestamp_tb2 where col2 = "2023-02-02 
00:00:00.123456";"""
+        qt_8_11 """ select * from timestamp_tb2 where col2 <= "2023-02-02 
00:00:00.123456";"""
+        qt_8_12 """ select * from timestamp_tb2 where col2 < "2023-02-02 
00:00:00.123456";"""
+        qt_8_13 """ select * from timestamp_tb2 where col2 != "2023-02-02 
00:00:00.123456";"""
+
+        sql """ set time_zone = "UTC" """
+
+        qt_9_1 """ select * from datetime_tb1;"""
+        qt_9_2 """ select * from datetime_tb1 where col1 > "2023-02-01 
16:00:00.000";"""
+        qt_9_3 """ select * from datetime_tb1 where col1 >= "2023-02-01 
16:00:00.000";"""
+        qt_9_4 """ select * from datetime_tb1 where col1 = "2023-02-01 
16:00:00.000";"""
+        qt_9_5 """ select * from datetime_tb1 where col1 <= "2023-02-01 
16:00:00.000";"""
+        qt_9_6 """ select * from datetime_tb1 where col1 < "2023-02-01 
16:00:00.000";"""
+        qt_9_7 """ select * from datetime_tb1 where col1 != "2023-02-01 
16:00:00.000";"""
+
+
+
+        qt_10_1 """ select * from timestamp_tb2;"""
+        qt_10_2 """ select * from timestamp_tb2 where col1 > "2023-02-01 
16:00:00.123456";"""
+        qt_10_3 """ select * from timestamp_tb2 where col1 >= "2023-02-01 
16:00:00.123456";"""
+        qt_10_4 """ select * from timestamp_tb2 where col1 = "2023-02-01 
16:00:00.123456";"""
+        qt_10_5 """ select * from timestamp_tb2 where col1 <= "2023-02-01 
16:00:00.123456";"""
+        qt_10_6 """ select * from timestamp_tb2 where col1 < "2023-02-01 
16:00:00.123456";"""
+        qt_10_7 """ select * from timestamp_tb2 where col1 != "2023-02-01 
16:00:00.123456";"""
+    
+        qt_10_8 """ select * from timestamp_tb1 where col2 > "2023-02-02 
00:00:00.123456"; """ 
+        qt_10_9 """ select * from timestamp_tb1 where col2 >= "2023-02-02 
00:00:00.123456"; """ 
+        qt_10_10 """ select * from timestamp_tb1 where col2 = "2023-02-02 
00:00:00.123456"; """ 
+        qt_10_11 """ select * from timestamp_tb1 where col2 <= "2023-02-02 
00:00:00.123456"; """ 
+        qt_10_12 """ select * from timestamp_tb1 where col2 < "2023-02-02 
00:00:00.123456"; """ 
+        qt_10_13 """ select * from timestamp_tb1 where col2 != "2023-02-02 
00:00:00.123456"; """ 
+
+    }
+}
\ No newline at end of file


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

Reply via email to