From 2a25b90cb33690a291e21c48b7cbc0386a78babd Mon Sep 17 00:00:00 2001 From: Pxl <952130278@qq.com> Date: Thu, 7 Apr 2022 14:23:57 +0800 Subject: [PATCH] [Test] Fix explode test and build fail (#8885) --- be/CMakeLists.txt | 6 +- ..._json_array.out => explode_json_array.out} | 18 ++-- .../{explose_split.out => explode_split.out} | 8 +- .../table_function/explode_json_array.groovy | 84 +++++++++++++++++++ .../table_function/explode_split.groovy | 51 +++++++++++ .../table_function/explose_json_array.groovy | 64 -------------- .../table_function/explose_split.groovy | 32 ------- 7 files changed, 149 insertions(+), 114 deletions(-) rename regression-test/data/table_function/{explose_json_array.out => explode_json_array.out} (93%) rename regression-test/data/table_function/{explose_split.out => explode_split.out} (81%) create mode 100644 regression-test/suites/table_function/explode_json_array.groovy create mode 100644 regression-test/suites/table_function/explode_split.groovy delete mode 100644 regression-test/suites/table_function/explose_json_array.groovy delete mode 100644 regression-test/suites/table_function/explose_split.groovy diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index 88ac194f39..263b6feb83 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -358,7 +358,7 @@ set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_SYSTEM_NO_DEPRECATED") # Enable the cpu and heap profile of brpc set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBRPC_ENABLE_CPU_PROFILER") -if (USE_LLD) +if (USE_LLD AND NOT MAKE_TEST) set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fuse-ld=lld") endif () @@ -691,10 +691,6 @@ set (TEST_LINK_LIBS ${DORIS_LINK_LIBS} set(BUILD_SHARED_LIBS OFF) if (${MAKE_TEST} STREQUAL "ON") - if (USE_LLD) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld") - endif () - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -DGTEST_USE_OWN_TR1_TUPLE=0") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov") add_definitions(-DBE_TEST) diff --git a/regression-test/data/table_function/explose_json_array.out b/regression-test/data/table_function/explode_json_array.out similarity index 93% rename from regression-test/data/table_function/explose_json_array.out rename to regression-test/data/table_function/explode_json_array.out index 43521562af..60696b758b 100644 --- a/regression-test/data/table_function/explose_json_array.out +++ b/regression-test/data/table_function/explode_json_array.out @@ -1,5 +1,5 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 40 30 100 John 30 1 Street 1 80 30 100 John 30 1 Street 1 40 60 @@ -17,17 +17,17 @@ 400 Dan 50 4 Street 4 40 60 400 Dan 50 4 Street 4 80 60 --- !explose_json_array -- +-- !explode_json_array -- 30 8 60 8 --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 \N 200 Mary \N 1 Street 2 \N 300 Mike 80 3 Street 3 \N 400 Dan 50 4 Street 4 \N --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 1.23 1 100 John 30 1 Street 1 22.214 1 100 John 30 1 Street 1 214.1 1 @@ -65,10 +65,10 @@ 400 Dan 50 4 Street 4 22.214 b 400 Dan 50 4 Street 4 214.1 b --- !explose_json_array -- +-- !explode_json_array -- true --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 40 30 100 John 30 1 Street 1 80 30 100 John 30 1 Street 1 40 60 @@ -86,17 +86,17 @@ true 400 Dan 50 4 Street 4 40 60 400 Dan 50 4 Street 4 80 60 --- !explose_json_array -- +-- !explode_json_array -- 30 8 60 8 --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 \N 200 Mary \N 1 Street 2 \N 300 Mike 80 3 Street 3 \N 400 Dan 50 4 Street 4 \N --- !explose_json_array -- +-- !explode_json_array -- 100 John 30 1 Street 1 1.23 1 100 John 30 1 Street 1 22.214 1 100 John 30 1 Street 1 214.1 1 diff --git a/regression-test/data/table_function/explose_split.out b/regression-test/data/table_function/explode_split.out similarity index 81% rename from regression-test/data/table_function/explose_split.out rename to regression-test/data/table_function/explode_split.out index 6e85625c29..4439d5e676 100644 --- a/regression-test/data/table_function/explose_split.out +++ b/regression-test/data/table_function/explode_split.out @@ -1,10 +1,10 @@ -- This file is automatically generated. You should know what you did if you want to edit this --- !explose_split -- +-- !explode_split -- 1 a,b,c a 1 a,b,c b 1 a,b,c c --- !explose_split -- +-- !explode_split -- 1 a,b,c a a 1 a,b,c a b 1 a,b,c a c @@ -15,12 +15,12 @@ 1 a,b,c c b 1 a,b,c c c --- !explose_split -- +-- !explode_split -- 1 a,b,c a 1 a,b,c b 1 a,b,c c --- !explose_split -- +-- !explode_split -- 1 a,b,c a a 1 a,b,c a b 1 a,b,c a c diff --git a/regression-test/suites/table_function/explode_json_array.groovy b/regression-test/suites/table_function/explode_json_array.groovy new file mode 100644 index 0000000000..9460101ea7 --- /dev/null +++ b/regression-test/suites/table_function/explode_json_array.groovy @@ -0,0 +1,84 @@ +// 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') """ + + sql """ set enable_lateral_view = true """ + + // 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 """ + + // 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 """ + +} \ No newline at end of file diff --git a/regression-test/suites/table_function/explode_split.groovy b/regression-test/suites/table_function/explode_split.groovy new file mode 100644 index 0000000000..4af2bad8d8 --- /dev/null +++ b/regression-test/suites/table_function/explode_split.groovy @@ -0,0 +1,51 @@ +// 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') """ + + sql """ set enable_lateral_view = true """ + + // 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 """ + +} \ No newline at end of file diff --git a/regression-test/suites/table_function/explose_json_array.groovy b/regression-test/suites/table_function/explose_json_array.groovy deleted file mode 100644 index ed754505e0..0000000000 --- a/regression-test/suites/table_function/explose_json_array.groovy +++ /dev/null @@ -1,64 +0,0 @@ -// The cases is copied from -// https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-lateral-view.html -// and modified by Doris. - -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') """ - -sql """ set enable_lateral_view = true """ - -// not vectorized -qt_explose_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_explose_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_explose_json_array """ SELECT * FROM ${tableName} - LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[]') t1 AS c_age - ORDER BY id, c_age """ - -qt_explose_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 """ - -// vectorized -sql """ set enable_vectorized_engine = true """ - -qt_explose_json_array """ select @@enable_vectorized_engine """ -qt_explose_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_explose_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_explose_json_array """ SELECT * FROM ${tableName} - LATERAL VIEW EXPLODE_JSON_ARRAY_INT('[]') t1 AS c_age - ORDER BY id, c_age """ - -qt_explose_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 """ \ No newline at end of file diff --git a/regression-test/suites/table_function/explose_split.groovy b/regression-test/suites/table_function/explose_split.groovy deleted file mode 100644 index 429c5a3586..0000000000 --- a/regression-test/suites/table_function/explose_split.groovy +++ /dev/null @@ -1,32 +0,0 @@ -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') """ - -sql """ set enable_lateral_view = true """ - -// not_vectorized -qt_explose_split """ select * from ${tableName} - lateral view explode_split(k2, ',') tmp1 as e1 """ - -qt_explose_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_explose_split """ select * from ${tableName} - lateral view explode_split(k2, ',') tmp1 as e1 """ - -qt_explose_split """ select * from ${tableName} - lateral view explode_split(k2, ',') tmp1 as e1 - lateral view explode_split(k2, ',') tmp2 as e2 """ -