This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 87756f5441 [regresstion](query) query with limit 0 regresstion test
(#15245)
87756f5441 is described below
commit 87756f54418b29a583dc01fd98b85fe0b62eaca8
Author: chenlinzhong <[email protected]>
AuthorDate: Thu Dec 22 14:06:44 2022 +0800
[regresstion](query) query with limit 0 regresstion test (#15245)
---
.../org/apache/doris/regression/suite/Suite.groovy | 17 +++++++++
.../suites/query_p1/test_limit_0.groovy | 43 ++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 3bf93105df..cc82bf4e50 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -198,6 +198,23 @@ class Suite implements GroovyInterceptable {
return result
}
+ List<List<String>> sql_meta(String sqlStr, boolean isOrder = false) {
+ logger.info("Execute ${isOrder ? "order_" : ""}sql:
${sqlStr}".toString())
+ def (tmp, rsmd) = JdbcUtils.executeToList(context.getConnection(),
sqlStr)
+ int count = rsmd.getColumnCount();
+ List<List<String>> result = new ArrayList<>()
+ for (int i = 0; i < count; i++) {
+ List<String> item = new ArrayList<>()
+ String columnName = rsmd.getColumnName(i + 1);
+ int columnType = rsmd.getColumnType(i+1);
+ String columnTypeName = rsmd.getColumnTypeName(i+1);
+ item.add(columnName);
+ item.add(columnTypeName);
+ result.add(item);
+ }
+ return result;
+ }
+
List<List<Object>> order_sql(String sqlStr) {
return sql(sqlStr, true)
}
diff --git a/regression-test/suites/query_p1/test_limit_0.groovy
b/regression-test/suites/query_p1/test_limit_0.groovy
new file mode 100644
index 0000000000..e25c120773
--- /dev/null
+++ b/regression-test/suites/query_p1/test_limit_0.groovy
@@ -0,0 +1,43 @@
+// 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_limit_0") {
+ def dbName = "test_limit_0"
+ sql "DROP DATABASE IF EXISTS ${dbName}"
+ sql """
+ CREATE TABLE IF NOT EXISTS `${dbName}` (
+ `k1` smallint NULL,
+ `k2` int NULL,
+ `k3` bigint NULL,
+ `k4` varchar(20) NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`k1`,`k2`,`k3`,`k4`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+ PROPERTIES("replication_num" = "1");
+ """
+ def result = sql_meta "select * from (select * from ${dbName} ) a limit 0"
+ print result
+ assertTrue(result[0][0]=='k1');
+ assertTrue(result[0][1]=='SMALLINT');
+ assertTrue(result[1][0]=='k2');
+ assertTrue(result[1][1]=='INT');
+ assertTrue(result[2][0]=='k3');
+ assertTrue(result[2][1]=='BIGINT');
+ assertTrue(result[3][0]=='k4');
+ assertTrue(result[3][1]=='CHAR');
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]