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


##########
regression-test/suites/schema_change_p0/test_add_keys_light_schema_change.groovy:
##########
@@ -0,0 +1,454 @@
+// 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.
+
+import groovy.json.JsonOutput
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite ("test_add_keys_light_schema_change") {
+    def getJobState = { tableName ->
+         def jobStateResult = sql """  SHOW ALTER TABLE COLUMN WHERE 
IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+         return jobStateResult[0][9]
+    }
+
+    def getJobTxnId = { tableName ->
+         def jobStateResult = sql """  SHOW ALTER TABLE COLUMN WHERE 
IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+         return jobStateResult[0][8]
+    }
+
+    def getCreateViewState = { tableName ->
+        def createViewStateResult = sql """ SHOW ALTER TABLE MATERIALIZED VIEW 
WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """
+        return createViewStateResult[0][8]
+    }
+
+    def waitJobFinish = { strSql, statePos -> 
+        Object jobStateResult = null
+        int max_try_time = 2000
+        while (max_try_time--){
+            jobStateResult = sql """${strSql}"""
+            def jsonRes = JsonOutput.toJson(jobStateResult)
+            String result = jobStateResult[0][statePos]
+            if (result == "FINISHED") {
+                log.info(jsonRes)
+                sleep(500)
+                break
+            } else {
+                sleep(100)
+                if (max_try_time < 1){
+                    assertEquals(1,2)
+                }
+            }
+        }
+        return jobStateResult
+    }
+    
+    def tableName = "add_keys_light_schema_change"
+    try {
+
+        String backend_id;
+        def backendId_to_backendIP = [:]
+        def backendId_to_backendHttpPort = [:]
+        getBackendIpHttpPort(backendId_to_backendIP, 
backendId_to_backendHttpPort);
+
+        backend_id = backendId_to_backendIP.keySet()[0]
+        def (code, out, err) = 
show_be_config(backendId_to_backendIP.get(backend_id), 
backendId_to_backendHttpPort.get(backend_id))
+        
+        logger.info("Show config: code=" + code + ", out=" + out + ", err=" + 
err)
+        assertEquals(code, 0)
+        def configList = parseJson(out.trim())
+        assert configList instanceof List
+
+        boolean disableAutoCompaction = true
+        for (Object ele in (List) configList) {
+            assert ele instanceof List<String>
+            if (((List<String>) ele)[0] == "disable_auto_compaction") {
+                disableAutoCompaction = Boolean.parseBoolean(((List<String>) 
ele)[2])
+            }
+        }
+        int max_try_time = 3000
+        List<List<Object>> table_tablets = null;
+        List<List<Object>> rowset_cnt = null;
+
+        // case 1.1: light schema change type check: add key column in short 
key column num
+        sql """ DROP TABLE IF EXISTS add_keys_light_schema_change """
+        sql """
+                CREATE TABLE IF NOT EXISTS add_keys_light_schema_change (
+                    `user_id` LARGEINT NOT NULL COMMENT "用户id",

Review Comment:
   should test all typed key columns such as string,date,int.
   For example, the original key column could be one of string,date,int 
   and you add a new key column, it could also be one of string,date,int



-- 
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