Skip to content

Commit

Permalink
[fix](runtime filter) Disable build_bf_exactly if `sync_filter_size… (
Browse files Browse the repository at this point in the history
apache#44169)

…` is disabled

When a bloom filter has multiple targets, it should use a size which is
estimated by FE.
  • Loading branch information
Gabriel39 committed Nov 21, 2024
1 parent 67e0500 commit d3a11f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions be/src/exprs/runtime_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,18 +1337,19 @@ Status IRuntimeFilter::init_with_desc(const TRuntimeFilterDesc* desc, const TQue
params.runtime_bloom_filter_min_size = options->__isset.runtime_bloom_filter_min_size
? options->runtime_bloom_filter_min_size
: 0;
auto sync_filter_size = desc->__isset.sync_filter_size && desc->sync_filter_size;
// We build runtime filter by exact distinct count iff three conditions are met:
// 1. Only 1 join key
// 2. Do not have remote target (e.g. do not need to merge), or broadcast join
// 3. Bloom filter
// 2. Bloom filter
// 3. Size of all bloom filters will be same (size will be sync or this is a broadcast join).
params.build_bf_exactly =
build_bf_exactly && (_runtime_filter_type == RuntimeFilterType::BLOOM_FILTER ||
_runtime_filter_type == RuntimeFilterType::IN_OR_BLOOM_FILTER);

params.bloom_filter_size_calculated_by_ndv = desc->bloom_filter_size_calculated_by_ndv;

if (!desc->__isset.sync_filter_size || !desc->sync_filter_size) {
params.build_bf_exactly &= (!_has_remote_target || _is_broadcast_join);
if (!sync_filter_size) {
params.build_bf_exactly &= !_is_broadcast_join;
}

if (desc->__isset.bloom_filter_size_bytes) {
Expand Down

0 comments on commit d3a11f2

Please sign in to comment.