apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.8k stars 3.3k forks source link

[Bug] BE crashed because a condition like 'HLL != hll_empty()' #29816

Open reimylove001 opened 10 months ago

reimylove001 commented 10 months ago

Search before asking

Version

2.0.3

What's Wrong?

be crashed

What You Expected?

Reports an error, intercepts this operation, or works well if possible.

How to Reproduce?

Table like this:

create table test_hll
(
 id int,
  hll_1 hll hll_union
)
AGGREGATE key(id)
DISTRIBUTED BY HASH(id) BUCKETS 10;

Give one record:

insert into test_hll
select  1, hll_hash(1);

Query with condition using hll_1 directly:

select * from test_hll where hll_1 != hll_empty();

Then BE Crashed:

(gdb) bt
#0  doris::create_predicate<(doris::PredicateType)2, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (column=..., index=1, conditions=..., arena=0x7fcf4caccb30, opposite=<optimized out>) at /root/doris/be/src/olap/predicate_creator.h:247
#1  doris::create_comparison_predicate<(doris::PredicateType)2> (column=..., index=1, condition=..., opposite=false, arena=0x7fcf4caccb30) at /root/doris/be/src/olap/predicate_creator.h:255
#2  0x0000560441fab162 in doris::parse_to_predicate (column=..., index=1, condition=..., arena=0x7fcf4caccb30, opposite==false) at /root/doris/be/src/olap/predicate_creator.h:306
#3  0x0000560441fa0ee1 in doris::TabletReader::_init_conditions_param (this=this@entry=0x7fcf77f02000, read_params=...) at /root/doris/be/src/olap/reader.cpp:478
#4  0x0000560441f9fbf0 in doris::TabletReader::_init_params (this=this@entry=0x7fcf77f02000, read_params=...) at /root/doris/be/src/olap/reader.cpp:273
#5  0x0000560441f9f86f in doris::TabletReader::init (this=0x7fcf77f02000, read_params=...) at /root/doris/be/src/olap/reader.cpp:129
#6  0x0000560449bf30ff in doris::vectorized::BlockReader::init (this=0x7fd30f5460fc, read_params=...) at /root/doris/be/src/vec/olap/block_reader.cpp:206
...

Anything Else?

I really known that the type HLL should must be used with the function hll_union_agg, hll_raw_agg or hll_cardinality!

But, why wasn't this operation intercepted like ‘HLL != hll_empty()’?

I believe that crash is not an appropriate or standard method to regulate user behavior.

Are you willing to submit PR?

Code of Conduct

reimylove001 commented 10 months ago

I want to resolve this bug, but don't known what is the best way to intercepts this operation.

BiteTheDDDDt commented 10 months ago

I think you can prohibit hll types from doing comparison operations at the optimizer level.