Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore](runtime-filter) refactor of runtime filter void type data usage #43957

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 30 additions & 34 deletions be/src/exprs/hybrid_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,8 @@

#pragma once

#include <glog/logging.h>

#include <type_traits>

#include "common/exception.h"
#include "common/object_pool.h"
#include "common/status.h"
#include "exprs/runtime_filter.h"
#include "runtime/decimalv2_value.h"
#include "runtime/define_primitive_type.h"
#include "runtime/primitive_type.h"
#include "vec/columns/column_nullable.h"
#include "vec/columns/column_string.h"
#include "vec/common/hash_table/phmap_fwd_decl.h"
#include "vec/common/string_ref.h"
#include "exprs/runtime_filter_convertor.h"

namespace doris {

Expand Down Expand Up @@ -221,30 +208,19 @@ class HybridSetBase : public RuntimeFilterFuncBase {
virtual bool find(const void* data, size_t) const = 0;

virtual void find_batch(const doris::vectorized::IColumn& column, size_t rows,
doris::vectorized::ColumnUInt8::Container& results) {
LOG(FATAL) << "HybridSetBase not support find_batch";
__builtin_unreachable();
}

doris::vectorized::ColumnUInt8::Container& results) = 0;
virtual void find_batch_negative(const doris::vectorized::IColumn& column, size_t rows,
doris::vectorized::ColumnUInt8::Container& results) {
LOG(FATAL) << "HybridSetBase not support find_batch_negative";
__builtin_unreachable();
}

doris::vectorized::ColumnUInt8::Container& results) = 0;
virtual void find_batch_nullable(const doris::vectorized::IColumn& column, size_t rows,
const doris::vectorized::NullMap& null_map,
doris::vectorized::ColumnUInt8::Container& results) {
LOG(FATAL) << "HybridSetBase not support find_batch_nullable";
__builtin_unreachable();
}
doris::vectorized::ColumnUInt8::Container& results) = 0;

virtual void find_batch_nullable_negative(const doris::vectorized::IColumn& column, size_t rows,
const doris::vectorized::NullMap& null_map,
doris::vectorized::ColumnUInt8::Container& results) {
LOG(FATAL) << "HybridSetBase not support find_batch_nullable_negative";
__builtin_unreachable();
}
virtual void find_batch_nullable_negative(
const doris::vectorized::IColumn& column, size_t rows,
const doris::vectorized::NullMap& null_map,
doris::vectorized::ColumnUInt8::Container& results) = 0;

virtual void to_pb(PInFilter* filter) = 0;

class IteratorBase {
public:
Expand Down Expand Up @@ -409,6 +385,14 @@ class HybridSet : public HybridSetBase {

ContainerType* get_inner_set() { return &_set; }

void set_pb(PInFilter* filter, auto f) {
for (auto v : _set) {
f(filter->add_values(), v);
}
}

void to_pb(PInFilter* filter) override { set_pb(filter, get_convertor<ElementType>()); }

private:
ContainerType _set;
ObjectPool _pool;
Expand Down Expand Up @@ -569,6 +553,14 @@ class StringSet : public HybridSetBase {

ContainerType* get_inner_set() { return &_set; }

void set_pb(PInFilter* filter, auto f) {
for (auto v : _set) {
f(filter->add_values(), v);
}
}

void to_pb(PInFilter* filter) override { set_pb(filter, get_convertor<std::string>()); }

private:
ContainerType _set;
ObjectPool _pool;
Expand Down Expand Up @@ -735,6 +727,10 @@ class StringValueSet : public HybridSetBase {

ContainerType* get_inner_set() { return &_set; }

void to_pb(PInFilter* filter) override {
throw Exception(ErrorCode::INTERNAL_ERROR, "StringValueSet do not support to_pb");
}

private:
ContainerType _set;
ObjectPool _pool;
Expand Down
23 changes: 14 additions & 9 deletions be/src/exprs/minmax_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@

#pragma once

#include <type_traits>

#include "common/object_pool.h"
#include "exprs/runtime_filter.h"
#include "runtime/type_limit.h"
#include "vec/columns/column.h"
#include "vec/columns/column_nullable.h"
#include "vec/columns/column_string.h"
#include "vec/common/assert_cast.h"
#include "vec/common/string_ref.h"
#include "exprs/runtime_filter_convertor.h"

namespace doris {
// only used in Runtime Filter
Expand All @@ -45,6 +37,8 @@ class MinMaxFuncBase : public RuntimeFilterFuncBase {

void set_contain_null() { _contain_null = true; }

virtual void to_pb(PMinMaxFilter* filter) = 0;

protected:
bool _contain_null = false;
};
Expand Down Expand Up @@ -165,6 +159,17 @@ class MinMaxNumFunc : public MinMaxFuncBase {
return Status::OK();
}

void set_pb(PMinMaxFilter* filter, auto f) {
if constexpr (NeedMin) {
f(filter->mutable_min_val(), _min);
}
if constexpr (NeedMax) {
f(filter->mutable_max_val(), _max);
}
}

void to_pb(PMinMaxFilter* filter) override { set_pb(filter, get_convertor<T>()); }

protected:
T _max = type_limit<T>::min();
T _min = type_limit<T>::max();
Expand Down
Loading
Loading