69 lines
1.9 KiB
Groovy
69 lines
1.9 KiB
Groovy
// 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("adjust_nullable") {
|
|
sql "SET enable_nereids_planner=true"
|
|
sql "SET enable_fallback_to_original_planner=false"
|
|
|
|
sql """
|
|
DROP TABLE IF EXISTS agg_subquery_table
|
|
"""
|
|
sql """
|
|
CREATE TABLE IF NOT EXISTS agg_subquery_table(
|
|
gid varchar(50) NOT NULL,
|
|
num int(11) SUM NOT NULL DEFAULT "0",
|
|
id_bitmap bitmap BITMAP_UNION NOT NULL
|
|
) ENGINE = OLAP
|
|
AGGREGATE KEY(gid)
|
|
DISTRIBUTED BY HASH(gid) BUCKETS 4
|
|
PROPERTIES (
|
|
"replication_allocation" = "tag.location.default: 1"
|
|
);
|
|
"""
|
|
|
|
sql """
|
|
INSERT INTO agg_subquery_table VALUES
|
|
('1',4,to_bitmap(7)),
|
|
('2',5,to_bitmap(8)),
|
|
('3',6,to_bitmap(9));
|
|
"""
|
|
|
|
sql """sync"""
|
|
|
|
qt_select """
|
|
SELECT
|
|
subq_1.gid AS c0
|
|
FROM
|
|
agg_subquery_table AS subq_1
|
|
WHERE
|
|
EXISTS (
|
|
SELECT
|
|
ref_2.amt AS c2
|
|
FROM (
|
|
SELECT
|
|
bitmap_union_count(id_bitmap) AS unt,
|
|
sum(num) AS amt
|
|
FROM
|
|
agg_subquery_table
|
|
) AS ref_2
|
|
)
|
|
order by
|
|
subq_1.gid;
|
|
"""
|
|
}
|
|
|