Skip to content

Commit

Permalink
[regression](lateral view) add test case for explode_bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Sep 15, 2023
1 parent c5e7f55 commit f29dd95
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
8 changes: 8 additions & 0 deletions regression-test/data/nereids_syntax_p0/lateral_view.out
Original file line number Diff line number Diff line change
Expand Up @@ -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

17 changes: 17 additions & 0 deletions regression-test/data/query_p0/lateral_view/lateral_view.out
Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions regression-test/suites/nereids_syntax_p0/lateral_view.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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;"""

}
38 changes: 38 additions & 0 deletions regression-test/suites/query_p0/lateral_view/lateral_view.groovy
Original file line number Diff line number Diff line change
@@ -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;"""
}

0 comments on commit f29dd95

Please sign in to comment.