yiguolei commented on code in PR #27352:
URL: https://github.com/apache/doris/pull/27352#discussion_r1400385521


##########
regression-test/suites/datatype_p0/decimalv2/test_decimalv2_common.groovy:
##########
@@ -0,0 +1,411 @@
+// 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_decimalv2_common", "nonConcurrent") {
+
+    sql """
+        admin set frontend config("enable_decimal_conversion" = "false");
+    """
+
+    def table_normal = "test_decimalv2_common_normal_tbl"
+    def table_dup = "test_decimalv2_common_dup_tbl" // duplicate key
+    def table_uniq = "test_decimalv2_common_uniq_tbl" // unique key
+    def table_agg = "test_decimalv2_common_agg_tbl" // aggregate key
+    def table_dist = "test_decimalv2_common_dist_tbl" // distributed by
+    def table_part = "test_decimalv2_common_part_tbl"; // partition by
+
+    sql "drop table if exists ${table_dup}"
+    sql "drop table if exists ${table_uniq}"
+    sql "drop table if exists ${table_agg}"
+    sql "drop table if exists ${table_dist}"
+    sql "drop table if exists ${table_part}"
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `${table_dup}` (
+            `decimal_key1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_key2` decimalv2(16, 5) NULL COMMENT "",
+            `decimal_value1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_value2` decimalv2(16, 5) NULL COMMENT "",
+            INDEX `idx_key1` (`decimal_value1`) USING BITMAP,
+            INDEX `idx_key2` (`decimal_value2`) USING BITMAP
+          ) ENGINE=OLAP
+          DUPLICATE KEY(`decimal_key1`, `decimal_key2`)
+          COMMENT "OLAP"
+          DISTRIBUTED BY HASH(`decimal_key1`, `decimal_key2`) BUCKETS 4
+          PROPERTIES (
+          "replication_allocation" = "tag.location.default: 1",
+          "in_memory" = "false",
+          "storage_format" = "V2"
+        )
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `${table_uniq}` (
+            `decimal_key1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_key2` decimalv2(16, 5) NULL COMMENT "",
+            `decimal_value1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_value2` decimalv2(16, 5) NULL COMMENT "",
+            INDEX `idx_key1` (`decimal_value1`) USING BITMAP,
+            INDEX `idx_key2` (`decimal_value2`) USING BITMAP
+          ) ENGINE=OLAP
+          UNIQUE KEY(`decimal_key1`, `decimal_key2`)
+          COMMENT "OLAP"
+          DISTRIBUTED BY HASH(`decimal_key1`, `decimal_key2`) BUCKETS 4
+          PROPERTIES (
+          "replication_allocation" = "tag.location.default: 1",
+          "in_memory" = "false",
+          "storage_format" = "V2"
+        )
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `${table_agg}` (
+            `decimal_key1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_key2` decimalv2(16, 5) NULL COMMENT "",
+            `decimal_value1` decimalv2(8, 5) sum NULL COMMENT "",
+            `decimal_value2` decimalv2(16, 5) max NULL COMMENT ""
+          ) ENGINE=OLAP
+          AGGREGATE KEY(`decimal_key1`, `decimal_key2`)
+          COMMENT "OLAP"
+          DISTRIBUTED BY HASH(`decimal_key1`, `decimal_key2`) BUCKETS 4
+          PROPERTIES (
+          "replication_allocation" = "tag.location.default: 1",
+          "in_memory" = "false",
+          "storage_format" = "V2"
+        )
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `${table_dist}` (
+            `decimal_key1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_key2` decimalv2(16, 5) NULL COMMENT "",
+            `decimal_value1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_value2` decimalv2(16, 5) NULL COMMENT "",
+            INDEX `idx_key1` (`decimal_value1`) USING BITMAP,
+            INDEX `idx_key2` (`decimal_value2`) USING BITMAP
+          ) ENGINE=OLAP
+          DUPLICATE KEY(`decimal_key1`, `decimal_key2`)
+          COMMENT "OLAP"
+          DISTRIBUTED BY HASH(`decimal_key1`, `decimal_key2`) BUCKETS 4
+          PROPERTIES (
+          "replication_allocation" = "tag.location.default: 1",
+          "in_memory" = "false",
+          "storage_format" = "V2"
+        )
+    """
+
+    /*** TODO:  Column[decimal_key1] type[decimalv2] cannot be a range 
partition key.
+    sql """
+        CREATE TABLE IF NOT EXISTS `${table_part}` (
+            `decimal_key1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_key2` decimalv2(16, 5) NULL COMMENT "",
+            `decimal_value1` decimalv2(8, 5) NULL COMMENT "",
+            `decimal_value2` decimalv2(16, 5) NULL COMMENT "",
+            INDEX `idx_key1` (`decimal_value1`) USING BITMAP,
+            INDEX `idx_key2` (`decimal_value2`) USING BITMAP
+          ) ENGINE=OLAP
+          UNIQUE KEY(`decimal_key1`, `decimal_key2`)
+          PARTITION BY RANGE(`decimal_key1`) (
+            PARTITION `p1` VALUES LESS THAN ('1.1111'),
+            PARTITION `p2` VALUES LESS THAN ('2.2222'),
+            PARTITION `p3` VALUES LESS THAN ('3.3333'),
+            PARTITION `p4` VALUES LESS THAN ('4.4444'),
+            PARTITION `p5` VALUES LESS THAN ('5.5555'),
+            PARTITION `p6` VALUES LESS THAN ('100.9999')
+          )
+          DISTRIBUTED BY HASH(`decimal_key1`) BUCKETS 2
+          PROPERTIES (
+          "replication_allocation" = "tag.location.default: 1",
+          "in_memory" = "false",
+          "storage_format" = "V2"
+        )
+    """
+    */
+
+    def insert_data = { table_name ->
+        sql """
+            insert into ${table_name}
+                values
+                    (1.1111, 1.1111, 1.1111, 1.1111),
+                    (2.2222, 1.1111, 1.1111, 1.1111),
+                    (3.3333, 1.1111, 1.1111, 1.1111),
+                    (4.4444, 1.1111, 1.1111, 1.1111),
+                    (5.5555, 1.1111, 1.1111, 1.1111),
+                    (6.6666, 1.1111, 1.1111, 1.1111),
+                    (7.7777, 1.1111, 1.1111, 1.1111),
+                    (8.8888, 1.1111, 1.1111, 1.1111),
+                    (9.9999, 1.1111, 1.1111, 1.1111);
+        """
+        sql """
+            insert into ${table_name}
+                values
+                    (1.1111, 1.1111, 1.1111, 1.1111),
+                    (2.2222, 2.2222, 1.1111, 1.1111),
+                    (3.3333, 3.3333, 1.1111, 1.1111),
+                    (4.4444, 4.4444, 1.1111, 1.1111),
+                    (5.5555, 5.5555, 1.1111, 1.1111),
+                    (6.6666, 6.6666, 1.1111, 1.1111),
+                    (7.7777, 7.7777, 1.1111, 1.1111),
+                    (8.8888, 8.8888, 1.1111, 1.1111),
+                    (9.9999, 9.9999, 1.1111, 1.1111);
+        """
+        sql """
+            insert into ${table_name}
+                values
+                    (1.1111, 1.1111, 1.1111, 1.1111),
+                    (2.2222, 2.2222, 2.2222, 1.1111),
+                    (3.3333, 3.3333, 3.3333, 1.1111),
+                    (4.4444, 4.4444, 4.4444, 1.1111),
+                    (5.5555, 5.5555, 5.5555, 1.1111),
+                    (6.6666, 6.6666, 6.6666, 1.1111),
+                    (7.7777, 7.7777, 7.7777, 1.1111),
+                    (8.8888, 8.8888, 8.8888, 1.1111),
+                    (9.9999, 9.9999, 9.9999, 1.1111);
+        """
+        sql """
+            insert into ${table_name}
+                values
+                    (1.1111, 1.1111, 1.1111, 1.1111),
+                    (2.2222, 2.2222, 2.2222, 2.2222),
+                    (3.3333, 3.3333, 3.3333, 3.3333),
+                    (4.4444, 4.4444, 4.4444, 4.4444),
+                    (5.5555, 5.5555, 5.5555, 5.5555),
+                    (6.6666, 6.6666, 6.6666, 6.6666),
+                    (7.7777, 7.7777, 7.7777, 7.7777),
+                    (8.8888, 8.8888, 8.8888, 8.8888),
+                    (9.9999, 9.9999, 9.9999, 9.9999);
+        """
+        sql """
+            insert into ${table_name}
+                values
+                    (null, 1.1111, 1.1111, 1.1111),
+                    (2.2222, null, 2.2222, 2.2222),
+                    (3.3333, 3.3333, null, 3.3333),
+                    (4.4444, 4.4444, 4.4444, null),
+                    (5.5555, 5.5555, 5.5555, null),
+                    (6.6666, 6.6666, null, 6.6666),
+                    (7.7777, null, 7.7777, 7.7777),
+                    (null, 8.8888, 8.8888, 8.8888),
+                    (9.9999, null, 9.9999, 9.9999);
+        """
+        sql """
+            insert into ${table_name}
+                values
+                    (1.1111, null, 1.1111, 1.1111),
+                    (2.2222, 2.2222, null, 2.2222),
+                    (3.3333, 3.3333, 3.3333, null),
+                    (null, 4.4444, 4.4444, 4.4444),
+                    (5.5555, null, 5.5555, 5.5555),
+                    (6.6666, 6.6666, null, 6.6666),
+                    (7.7777, 7.7777, 7.7777, null),
+                    (null, 8.8888, 8.8888, 8.8888),
+                    (9.9999, null, 9.9999, 9.9999);
+        """
+    }
+
+    insert_data(table_dup)
+    insert_data(table_agg)
+    insert_data(table_uniq)
+    insert_data(table_dist)
+    // insert_data(table_part)
+
+    def run_predicate_test = { table_name, col, col_value, bitmap_col, 
bitmap_col_value, in_list ->
+        def query = """

Review Comment:
   add  comment here to explain test which case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to