forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
166 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
regression-test/suites/query/aggregate/window_funnel.groovy
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
regression-test/suites/table_function/explode_json_array.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// 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. | ||
|
||
// The cases is copied from | ||
// https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-lateral-view.html | ||
// and modified by Doris. | ||
|
||
suite("explode_json_array") { | ||
def tableName = "person" | ||
|
||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
sql """ | ||
CREATE TABLE ${tableName} | ||
(id INT, name STRING, age INT, class INT, address STRING) | ||
UNIQUE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 8 | ||
PROPERTIES("replication_num" = "1") | ||
""" | ||
|
||
sql """ INSERT INTO ${tableName} VALUES | ||
(100, 'John', 30, 1, 'Street 1'), | ||
(200, 'Mary', NULL, 1, 'Street 2'), | ||
(300, 'Mike', 80, 3, 'Street 3'), | ||
(400, 'Dan', 50, 4, 'Street 4') """ | ||
|
||
// not vectorized | ||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[30, 60]') t1 as c_age | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[40, 80]') t2 as d_age | ||
ORDER BY id, c_age, d_age """ | ||
|
||
qt_explode_json_array """ SELECT c_age, COUNT(1) FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[30, 60]') t1 as c_age | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[40, 80]') t2 as d_age | ||
GROUP BY c_age ORDER BY c_age """ | ||
|
||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[]') t1 AS c_age | ||
ORDER BY id, c_age """ | ||
|
||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_STRING('[1, "b", 3]') t1 as c | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE('[1.23, 22.214, 214.1]') t2 as d | ||
ORDER BY id, c, d """ | ||
|
||
qt_outer_join_explode_json_array """SELECT id, age, e1 FROM (SELECT id, age, e1 FROM (SELECT b.id, a.age FROM | ||
${tableName} a LEFT JOIN ${tableName} b ON a.id=b.age)T LATERAL VIEW EXPLODE_JSON_ARRAY_STRING('[1, "b", 3]') | ||
TMP AS e1) AS T ORDER BY age, e1""" | ||
|
||
// vectorized | ||
sql """ set enable_vectorized_engine = true """ | ||
|
||
qt_explode_json_array """ select @@enable_vectorized_engine """ | ||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[30, 60]') t1 as c_age | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[40, 80]') t2 as d_age | ||
ORDER BY id, c_age, d_age """ | ||
|
||
qt_explode_json_array """ SELECT c_age, COUNT(1) FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[30, 60]') t1 as c_age | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[40, 80]') t2 as d_age | ||
GROUP BY c_age ORDER BY c_age """ | ||
|
||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[]') t1 AS c_age | ||
ORDER BY id, c_age """ | ||
|
||
qt_explode_json_array """ SELECT * FROM ${tableName} | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_STRING('[1, "b", 3]') t1 as c | ||
LATERAL VIEW EXPLODE_JSON_ARRAY_DOUBLE('[1.23, 22.214, 214.1]') t2 as d | ||
ORDER BY id, c, d """ | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
regression-test/suites/table_function/explode_split.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("explode_split") { | ||
def tableName = "test_lv_str" | ||
|
||
sql """ DROP TABLE IF EXISTS ${tableName} """ | ||
sql """ | ||
CREATE TABLE ${tableName} | ||
(k1 INT, k2 STRING) | ||
UNIQUE KEY(k1) DISTRIBUTED BY HASH(k1) BUCKETS 8 | ||
PROPERTIES("replication_num" = "1") | ||
""" | ||
|
||
sql """ INSERT INTO ${tableName} VALUES (1, 'a,b,c') """ | ||
|
||
// not_vectorized | ||
qt_explode_split """ select * from ${tableName} | ||
lateral view explode_split(k2, ',') tmp1 as e1 """ | ||
|
||
qt_explode_split """ select * from ${tableName} | ||
lateral view explode_split(k2, ',') tmp1 as e1 | ||
lateral view explode_split(k2, ',') tmp2 as e2 """ | ||
|
||
// vectorized | ||
sql """ set enable_vectorized_engine = true """ | ||
|
||
qt_explode_split """ select * from ${tableName} | ||
lateral view explode_split(k2, ',') tmp1 as e1 """ | ||
|
||
qt_explode_split """ select * from ${tableName} | ||
lateral view explode_split(k2, ',') tmp1 as e1 | ||
lateral view explode_split(k2, ',') tmp2 as e2 """ | ||
|
||
} |