[fix](olap)Crashing caused by IS NULL expression (#17463)
Issue Number: close #17462
This commit is contained in:
@ -587,6 +587,8 @@ public:
|
||||
/// It's a special kind of column, that contain single value, but is not a ColumnConst.
|
||||
virtual bool is_dummy() const { return false; }
|
||||
|
||||
virtual bool is_exclusive() const { return use_count() == 1; }
|
||||
|
||||
/// Clear data of column, just like vector clear
|
||||
virtual void clear() {}
|
||||
|
||||
|
||||
@ -225,6 +225,11 @@ public:
|
||||
bool is_column_array() const override { return get_nested_column().is_column_array(); }
|
||||
bool is_fixed_and_contiguous() const override { return false; }
|
||||
bool values_have_fixed_size() const override { return nested_column->values_have_fixed_size(); }
|
||||
|
||||
bool is_exclusive() const override {
|
||||
return IColumn::is_exclusive() && nested_column->is_exclusive() && null_map->is_exclusive();
|
||||
}
|
||||
|
||||
size_t size_of_value_if_fixed() const override {
|
||||
return null_map->size_of_value_if_fixed() + nested_column->size_of_value_if_fixed();
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ void Block::filter_block_internal(Block* block, const std::vector<uint32_t>& col
|
||||
for (auto& col : columns_to_filter) {
|
||||
auto& column = block->get_by_position(col).column;
|
||||
if (column->size() != count) {
|
||||
if (column->use_count() == 1) {
|
||||
if (column->is_exclusive()) {
|
||||
const auto result_size = column->assume_mutable()->filter(filter);
|
||||
CHECK_EQ(result_size, count);
|
||||
} else {
|
||||
|
||||
@ -174,3 +174,8 @@
|
||||
-- !select14 --
|
||||
13
|
||||
|
||||
-- !select15 --
|
||||
1 \N abc
|
||||
3 \N ccc
|
||||
5 \N eeee
|
||||
|
||||
|
||||
@ -85,4 +85,34 @@ suite("test_null_predicate") {
|
||||
qt_select12 """ select id, name from ${tableName} where id < 110 or name is not null order by id, name; """
|
||||
qt_select13 """ select id, name from ${tableName} where id > 109 or name is not null order by id, name; """
|
||||
qt_select14 """ select count(1) from ${tableName} where name is not null; """
|
||||
|
||||
sql """ DROP TABLE IF EXISTS test_null_predicate2 """
|
||||
// Here, create a table and make the "value" column nullable before the "name" column.
|
||||
// Via: https://github.com/apache/doris/issues/17462
|
||||
sql """
|
||||
CREATE TABLE IF NOT EXISTS test_null_predicate2 (
|
||||
`id` INT,
|
||||
`value` double NULL,
|
||||
`name` varchar(30)
|
||||
) ENGINE=OLAP
|
||||
DUPLICATE KEY(`id`)
|
||||
COMMENT "OLAP"
|
||||
DISTRIBUTED BY HASH(`id`) BUCKETS 1
|
||||
PROPERTIES (
|
||||
"replication_num" = "1",
|
||||
"in_memory" = "false",
|
||||
"storage_format" = "V2"
|
||||
);
|
||||
"""
|
||||
|
||||
sql """
|
||||
INSERT INTO test_null_predicate2 values
|
||||
(1, null, "abc"),
|
||||
(2, 2.0, "efg"),
|
||||
(3, null, "ccc"),
|
||||
(4, 4.0, "ddd"),
|
||||
(5, null, "eeee");
|
||||
"""
|
||||
|
||||
qt_select15 """ select * from test_null_predicate2 where `value` is null order by id; """
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user