morningman commented on code in PR #51936:
URL: https://github.com/apache/doris/pull/51936#discussion_r2160646472


##########
regression-test/suites/external_table_p0/hive/test_multi_delimit_serde.groovy:
##########
@@ -0,0 +1,136 @@
+// 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_multi_delimit_serde", 
"p0,external,hive,external_docker,external_docker_hive") {
+    String enabled = context.config.otherConfigs.get("enableHiveTest")
+    if (enabled == null || !enabled.equalsIgnoreCase("true")) {
+        logger.info("disable Hive test.")
+        return;
+    }
+
+    for (String hivePrefix : ["hive2", "hive3"]) {
+        String hms_port = context.config.otherConfigs.get(hivePrefix + 
"HmsPort")
+        String catalog_name = "${hivePrefix}_test_multi_delimit_serde"
+        String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
+
+        sql """drop catalog if exists ${catalog_name}"""
+        sql """create catalog if not exists ${catalog_name} properties (
+            "type"="hms",
+            'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}'
+        );"""
+
+        logger.info("catalog " + catalog_name + " created")
+        sql """switch ${catalog_name};"""
+        logger.info("switched to catalog " + catalog_name)
+
+        sql """use `default`;"""
+
+        try {
+            // Test 1: MultiDelimitSerDe with |+| delimiter
+            hive_docker """

Review Comment:
   I saw you already add hql in 
`docker/thirdparties/docker-compose/hive/scripts/data/regression/multi_delimit_serde/create_table.hql`,
 why need to create here again?



##########
regression-test/suites/external_table_p0/hive/test_multi_delimit_serde.groovy:
##########
@@ -0,0 +1,136 @@
+// 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_multi_delimit_serde", 
"p0,external,hive,external_docker,external_docker_hive") {
+    String enabled = context.config.otherConfigs.get("enableHiveTest")
+    if (enabled == null || !enabled.equalsIgnoreCase("true")) {
+        logger.info("disable Hive test.")
+        return;
+    }
+
+    for (String hivePrefix : ["hive2", "hive3"]) {
+        String hms_port = context.config.otherConfigs.get(hivePrefix + 
"HmsPort")
+        String catalog_name = "${hivePrefix}_test_multi_delimit_serde"
+        String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
+
+        sql """drop catalog if exists ${catalog_name}"""
+        sql """create catalog if not exists ${catalog_name} properties (
+            "type"="hms",
+            'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}'
+        );"""
+
+        logger.info("catalog " + catalog_name + " created")
+        sql """switch ${catalog_name};"""
+        logger.info("switched to catalog " + catalog_name)
+
+        sql """use `default`;"""
+
+        try {
+            // Test 1: MultiDelimitSerDe with |+| delimiter
+            hive_docker """
+                CREATE TABLE IF NOT EXISTS multi_delimit_test1 (
+                    k1 int,
+                    k2 int,
+                    name string
+                )
+                ROW FORMAT SERDE 
'org.apache.hadoop.hive.serde2.MultiDelimitSerDe'
+                WITH SERDEPROPERTIES (
+                    'field.delim' = '|+|',
+                    'mapkey.delim' = '@',
+                    'collection.delim' = ':',
+                    'serialization.format' = '1',
+                    'serialization.encoding' = 'UTF-8'
+                )
+                STORED AS INPUTFORMAT
+                    'org.apache.hadoop.mapred.TextInputFormat'
+                OUTPUTFORMAT
+                    
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
+            """
+
+            hive_docker """INSERT OVERWRITE TABLE multi_delimit_test1 VALUES 
(1, 100, 'test1'), (2, 200, 'test2'), (3, 300, 'test3')"""
+
+            qt_01 """SELECT * FROM multi_delimit_test1 ORDER BY k1"""
+
+            // Test 2: Different multi-character delimiter
+            logger.info("Test 2: Creating table with || delimiter")
+            hive_docker """
+                CREATE TABLE IF NOT EXISTS multi_delimit_test2 (
+                    id int,
+                    value double,
+                    description string
+                )
+                ROW FORMAT SERDE 
'org.apache.hadoop.hive.serde2.MultiDelimitSerDe'
+                WITH SERDEPROPERTIES (
+                    'field.delim' = '||',
+                    'serialization.format' = '1'
+                )
+                STORED AS INPUTFORMAT
+                    'org.apache.hadoop.mapred.TextInputFormat'
+                OUTPUTFORMAT
+                    
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
+            """
+
+            hive_docker """INSERT OVERWRITE TABLE multi_delimit_test2 VALUES 
(1, 1.5, 'desc1'), (2, 2.5, 'desc2')"""
+
+            qt_02 """SELECT * FROM multi_delimit_test2 ORDER BY id"""
+
+            // Test 3: Complex multi-character delimiter
+            logger.info("Test 3: Creating table with complex delimiter")
+            hive_docker """
+                CREATE TABLE IF NOT EXISTS multi_delimit_test3 (
+                    col1 string,
+                    col2 string,
+                    col3 string
+                )
+                ROW FORMAT SERDE 
'org.apache.hadoop.hive.serde2.MultiDelimitSerDe'
+                WITH SERDEPROPERTIES (
+                    'field.delim' = ':::'
+                )
+                STORED AS INPUTFORMAT
+                    'org.apache.hadoop.mapred.TextInputFormat'
+                OUTPUTFORMAT
+                    
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
+            """
+
+            hive_docker """INSERT OVERWRITE TABLE multi_delimit_test3 VALUES 
('field1', 'field2', 'field3'), ('a', 'b', 'c')"""
+
+            qt_03 """SELECT * FROM multi_delimit_test3 ORDER BY col1"""

Review Comment:
   Please also test the insert command (Use Doris to write to Hive) for each 
table type



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to