diff --git a/regression-test/data/nereids_syntax_p0/lateral_view.out b/regression-test/data/nereids_syntax_p0/lateral_view.out index 991573e43e..4e850fbf69 100644 --- a/regression-test/data/nereids_syntax_p0/lateral_view.out +++ b/regression-test/data/nereids_syntax_p0/lateral_view.out @@ -127,3 +127,11 @@ 1 a u1 10 1 3 a u1 10 3 +-- !sql_explode_bitmap -- +1 1 +1 2 +1 3 +2 22 +2 33 +2 44 + diff --git a/regression-test/data/query_p0/lateral_view/lateral_view.out b/regression-test/data/query_p0/lateral_view/lateral_view.out new file mode 100644 index 0000000000..cfc226109c --- /dev/null +++ b/regression-test/data/query_p0/lateral_view/lateral_view.out @@ -0,0 +1,17 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql_explode_bitmap0 -- +1 1 +1 2 +1 3 +2 22 +2 33 +2 44 + +-- !sql_explode_bitmap1 -- +1 1 +1 2 +1 3 +2 22 +2 33 +2 44 + diff --git a/regression-test/suites/nereids_syntax_p0/lateral_view.groovy b/regression-test/suites/nereids_syntax_p0/lateral_view.groovy index f7a32d8d24..5ec7bcba92 100644 --- a/regression-test/suites/nereids_syntax_p0/lateral_view.groovy +++ b/regression-test/suites/nereids_syntax_p0/lateral_view.groovy @@ -82,4 +82,19 @@ suite("nereids_lateral_view") { select 3 hourr,'a' pid_code ,'u1' uid, 10 money ) example1 lateral view explode_bitmap(bitmap_from_string("1,2,3,4")) tmp1 as e1 where hour=e1 order by hour; """ + + sql """ + CREATE TABLE `test_explode_bitmap` ( + `dt` int(11) NULL COMMENT "", + `page` varchar(10) NULL COMMENT "", + `user_id` bitmap BITMAP_UNION NULL COMMENT "" + ) ENGINE=OLAP + AGGREGATE KEY(`dt`, `page`) + DISTRIBUTED BY HASH(`dt`) BUCKETS 2 + properties("replication_num"="1"); + """ + sql """ insert into test_explode_bitmap values(1, '11', bitmap_from_string("1,2,3"));""" + sql """ insert into test_explode_bitmap values(2, '22', bitmap_from_string("22,33,44"));""" + qt_sql_explode_bitmap """ select dt, e1 from test_explode_bitmap lateral view explode_bitmap(user_id) tmp1 as e1 order by dt, e1;""" + } diff --git a/regression-test/suites/query_p0/lateral_view/lateral_view.groovy b/regression-test/suites/query_p0/lateral_view/lateral_view.groovy new file mode 100644 index 0000000000..6027922cde --- /dev/null +++ b/regression-test/suites/query_p0/lateral_view/lateral_view.groovy @@ -0,0 +1,38 @@ +// 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("lateral_view") { + sql """ DROP TABLE IF EXISTS `test_explode_bitmap` """ + sql """ + CREATE TABLE `test_explode_bitmap` ( + `dt` int(11) NULL COMMENT "", + `page` varchar(10) NULL COMMENT "", + `user_id` bitmap BITMAP_UNION NULL COMMENT "" + ) ENGINE=OLAP + AGGREGATE KEY(`dt`, `page`) + DISTRIBUTED BY HASH(`dt`) BUCKETS 2 + properties("replication_num"="1"); + """ + sql """ insert into test_explode_bitmap values(1, '11', bitmap_from_string("1,2,3"));""" + sql """ insert into test_explode_bitmap values(2, '22', bitmap_from_string("22,33,44"));""" + + sql "SET enable_nereids_planner=false" + qt_sql_explode_bitmap0 """ select dt, e1 from test_explode_bitmap lateral view explode_bitmap(user_id) tmp1 as e1 order by dt, e1;""" + + sql "SET enable_nereids_planner=true" + qt_sql_explode_bitmap1 """ select dt, e1 from test_explode_bitmap lateral view explode_bitmap(user_id) tmp1 as e1 order by dt, e1;""" +}