[regression](lateral view) add test case for explode_bitmap (#24421)

This commit is contained in:
TengJianPing
2023-09-15 17:30:26 +08:00
committed by GitHub
parent 8297da56ad
commit 699023069d
4 changed files with 78 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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;"""
}

View File

@ -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;"""
}