This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new 4dda05980a [Bug](bloomfilter) Fix wrong result using bloomfilter with date type (#17225) (#17486) 4dda05980a is described below commit 4dda05980ad533ecebbdb4cc462f96385f444f8d Author: Gabriel <gabrielleeb...@gmail.com> AuthorDate: Tue Mar 7 13:36:05 2023 +0800 [Bug](bloomfilter) Fix wrong result using bloomfilter with date type (#17225) (#17486) pick #17225 --- be/src/exprs/bloomfilter_predicate.h | 12 ++---------- .../datatype_p0/date/test_date_runtime_filter.out | 20 ++++++++++++++++++++ .../datatype_p0/date/test_date_runtime_filter.groovy | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/be/src/exprs/bloomfilter_predicate.h b/be/src/exprs/bloomfilter_predicate.h index b6db148fe4..c0c6516fe6 100644 --- a/be/src/exprs/bloomfilter_predicate.h +++ b/be/src/exprs/bloomfilter_predicate.h @@ -328,22 +328,18 @@ struct FixedStringFindOp : public StringFindOp { } }; -struct DateTimeFindOp : public CommonFindOp<DateTimeValue> { +struct DateTimeFindOp : public CommonFindOp<vectorized::VecDateTimeValue> { bool find_olap_engine(const BloomFilterAdaptor& bloom_filter, const void* data) const { vectorized::VecDateTimeValue value; value.from_olap_datetime(*reinterpret_cast<const uint64_t*>(data)); return bloom_filter.test(Slice((char*)&value, sizeof(vectorized::VecDateTimeValue))); } - - void insert(BloomFilterAdaptor& bloom_filter, const void* data) const { - bloom_filter.add_bytes((char*)data, sizeof(vectorized::VecDateTimeValue)); - } }; // avoid violating C/C++ aliasing rules. // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101684 -struct DateFindOp : public CommonFindOp<DateTimeValue> { +struct DateFindOp : public CommonFindOp<vectorized::VecDateTimeValue> { bool find_olap_engine(const BloomFilterAdaptor& bloom_filter, const void* data) const { uint24_t date = *static_cast<const uint24_t*>(data); uint64_t value = uint32_t(date); @@ -353,10 +349,6 @@ struct DateFindOp : public CommonFindOp<DateTimeValue> { return bloom_filter.test(Slice((char*)&date_value, sizeof(vectorized::VecDateTimeValue))); } - - void insert(BloomFilterAdaptor& bloom_filter, const void* data) const { - bloom_filter.add_bytes((char*)data, sizeof(vectorized::VecDateTimeValue)); - } }; struct DecimalV2FindOp : public CommonFindOp<DecimalV2Value> { diff --git a/regression-test/data/datatype_p0/date/test_date_runtime_filter.out b/regression-test/data/datatype_p0/date/test_date_runtime_filter.out index a6051c0236..c860aebfe2 100644 --- a/regression-test/data/datatype_p0/date/test_date_runtime_filter.out +++ b/regression-test/data/datatype_p0/date/test_date_runtime_filter.out @@ -24,3 +24,23 @@ 2 2000-02-02 2000-02-02T11:11:11 2 2000-02-02 2000-02-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 +-- !sql2 -- +1 2000-01-01 2000-01-01T11:11:11 1 2000-01-01 2000-01-01T11:11:11 +2 2000-02-02 2000-02-02T11:11:11 2 2000-02-02 2000-02-02T11:11:11 +3 2000-03-02 2000-03-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 + +-- !sql2 -- +1 2000-01-01 2000-01-01T11:11:11 1 2000-01-01 2000-01-01T11:11:11 +2 2000-02-02 2000-02-02T11:11:11 2 2000-02-02 2000-02-02T11:11:11 +3 2000-03-02 2000-03-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 + +-- !sql2 -- +1 2000-01-01 2000-01-01T11:11:11 1 2000-01-01 2000-01-01T11:11:11 +2 2000-02-02 2000-02-02T11:11:11 2 2000-02-02 2000-02-02T11:11:11 +3 2000-03-02 2000-03-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 + +-- !sql2 -- +1 2000-01-01 2000-01-01T11:11:11 1 2000-01-01 2000-01-01T11:11:11 +2 2000-02-02 2000-02-02T11:11:11 2 2000-02-02 2000-02-02T11:11:11 +3 2000-03-02 2000-03-02T11:11:11 3 2000-03-02 2000-03-02T11:11:11 + diff --git a/regression-test/suites/datatype_p0/date/test_date_runtime_filter.groovy b/regression-test/suites/datatype_p0/date/test_date_runtime_filter.groovy index f1526c1517..109c0b5e85 100644 --- a/regression-test/suites/datatype_p0/date/test_date_runtime_filter.groovy +++ b/regression-test/suites/datatype_p0/date/test_date_runtime_filter.groovy @@ -45,5 +45,19 @@ suite("test_date_runtime_filter") { sql " set runtime_filter_type = 8; " qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" + sql " set runtime_filter_wait_time_ms = 0; " + + sql " set runtime_filter_type = 1; " + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" + + sql " set runtime_filter_type = 2; " + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" + + sql " set runtime_filter_type = 4; " + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" + + sql " set runtime_filter_type = 8; " + qt_sql2 "select * from ${tbName} a, ${tbName} b WHERE a.c3 = b.c3 ORDER BY a.c2" + sql "DROP TABLE ${tbName}" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org