You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2022/07/11 14:18:55 UTC
[doris] branch master updated: add regression test for array functions inside WHERE condition (#10748)
This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 27505773f5 add regression test for array functions inside WHERE condition (#10748)
27505773f5 is described below
commit 27505773f542c8e0f4311eb5c4d273cfb38869a8
Author: camby <10...@qq.com>
AuthorDate: Mon Jul 11 22:18:48 2022 +0800
add regression test for array functions inside WHERE condition (#10748)
Co-authored-by: cambyzju <zh...@baidu.com>
---
.../test_array_functions_with_where.out | 17 ++++++++
.../test_array_functions_with_where.groovy | 49 ++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/regression-test/data/query/sql_functions/array_functions/test_array_functions_with_where.out b/regression-test/data/query/sql_functions/array_functions/test_array_functions_with_where.out
new file mode 100644
index 0000000000..feca051aa5
--- /dev/null
+++ b/regression-test/data/query/sql_functions/array_functions/test_array_functions_with_where.out
@@ -0,0 +1,17 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !select --
+1 3
+
+-- !select --
+2 1
+
+-- !select --
+1 3
+
+-- !select --
+1 3
+
+-- !select --
+1 3
+2 1
+
diff --git a/regression-test/suites/query/sql_functions/array_functions/test_array_functions_with_where.groovy b/regression-test/suites/query/sql_functions/array_functions/test_array_functions_with_where.groovy
new file mode 100644
index 0000000000..a9b06828b4
--- /dev/null
+++ b/regression-test/suites/query/sql_functions/array_functions/test_array_functions_with_where.groovy
@@ -0,0 +1,49 @@
+// 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_array_functions_with_where", "query") {
+ def tableName = "tbl_test_array_functions_with_where"
+ // open enable_array_type
+ sql """ set enable_array_type = true """
+ // array functions only supported in vectorized engine
+ sql """ set enable_vectorized_engine = true """
+
+ sql """DROP TABLE IF EXISTS ${tableName}"""
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName} (
+ `k1` int(11) NULL COMMENT "",
+ `k2` ARRAY<int(11)> NOT NULL COMMENT "",
+ `k3` ARRAY<VARCHAR(20)> NULL COMMENT "",
+ `k4` ARRAY<int(11)> NULL COMMENT ""
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`k1`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "storage_format" = "V2"
+ )
+ """
+ sql """ INSERT INTO ${tableName} VALUES(1, [1, 2, 3], ["a", "b", ""], [1, 2]) """
+ sql """ INSERT INTO ${tableName} VALUES(2, [4], NULL, [5]) """
+ sql """ INSERT INTO ${tableName} VALUES(3, [], [], NULL) """
+
+ qt_select "SELECT k1, size(k2) FROM ${tableName} WHERE size(k2)=3 ORDER BY k1"
+ qt_select "SELECT k1, size(k2) FROM ${tableName} WHERE array_contains(k2, 4) ORDER BY k1"
+ qt_select "SELECT k1, size(k2) FROM ${tableName} WHERE element_at(k2, 1)=1 ORDER BY k1"
+ qt_select "SELECT k1, size(k2) FROM ${tableName} WHERE arrays_overlap(k2, k4) ORDER BY k1"
+ qt_select "SELECT k1, size(k2) FROM ${tableName} WHERE cardinality(k2)>0 ORDER BY k1, size(k2)"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org