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

[Bug](runtime-filter) support ip rf and use exception to replace dcheck when PrimitiveType to PColumnType #39985

Merged
merged 7 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
27 changes: 13 additions & 14 deletions be/src/exprs/runtime_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ PColumnType to_proto(PrimitiveType type) {
case TYPE_STRING:
return PColumnType::COLUMN_TYPE_STRING;
default:
DCHECK(false) << "Invalid type.";
throw Exception(ErrorCode::INTERNAL_ERROR, "runtime filter meet invalid type {}",
int(type));
}
DCHECK(false);
return PColumnType::COLUMN_TYPE_INT;
}

Expand Down Expand Up @@ -553,8 +553,7 @@ class RuntimePredicateWrapper {
return Status::OK();
}

Status assign(const PInFilter* in_filter, bool contain_null) {
PrimitiveType type = to_primitive_type(in_filter->column_type());
Status assign(const PInFilter* in_filter, bool contain_null, PrimitiveType type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'assign' exceeds recommended size/complexity thresholds [readability-function-size]

    Status assign(const PInFilter* in_filter, bool contain_null, PrimitiveType type) {
           ^
Additional context

be/src/exprs/runtime_filter.cpp:555: 153 lines including whitespace and comments (threshold 80)

    Status assign(const PInFilter* in_filter, bool contain_null, PrimitiveType type) {
           ^

_context->hybrid_set.reset(create_set(type));
if (contain_null) {
_context->hybrid_set->set_null_aware(true);
Expand Down Expand Up @@ -725,8 +724,7 @@ class RuntimePredicateWrapper {

// used by shuffle runtime filter
// assign this filter by protobuf
Status assign(const PMinMaxFilter* minmax_filter, bool contain_null) {
PrimitiveType type = to_primitive_type(minmax_filter->column_type());
Status assign(const PMinMaxFilter* minmax_filter, bool contain_null, PrimitiveType type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'assign' exceeds recommended size/complexity thresholds [readability-function-size]

    Status assign(const PMinMaxFilter* minmax_filter, bool contain_null, PrimitiveType type) {
           ^
Additional context

be/src/exprs/runtime_filter.cpp:726: 128 lines including whitespace and comments (threshold 80)

    Status assign(const PMinMaxFilter* minmax_filter, bool contain_null, PrimitiveType type) {
           ^

_context->minmax_func.reset(create_minmax_filter(type));

if (contain_null) {
Expand Down Expand Up @@ -1140,7 +1138,7 @@ Status IRuntimeFilter::push_to_remote(const TNetworkAddress* addr) {
merge_filter_request->set_filter_id(_filter_id);
merge_filter_request->set_is_pipeline(true);
auto column_type = _wrapper->column_type();
merge_filter_request->set_column_type(to_proto(column_type));
RETURN_IF_CATCH_EXCEPTION(merge_filter_request->set_column_type(to_proto(column_type)));
merge_filter_callback->cntl_->set_timeout_ms(wait_time_ms());

if (get_ignored()) {
Expand Down Expand Up @@ -1382,7 +1380,8 @@ Status IRuntimeFilter::create_wrapper(const UpdateRuntimeFilterParamsV2* param,
switch (filter_type) {
case PFilterType::IN_FILTER: {
DCHECK(param->request->has_in_filter());
return (*wrapper)->assign(&param->request->in_filter(), param->request->contain_null());
return (*wrapper)->assign(&param->request->in_filter(), param->request->contain_null(),
column_type);
}
case PFilterType::BLOOM_FILTER: {
DCHECK(param->request->has_bloom_filter());
Expand All @@ -1393,7 +1392,8 @@ Status IRuntimeFilter::create_wrapper(const UpdateRuntimeFilterParamsV2* param,
case PFilterType::MAX_FILTER:
case PFilterType::MINMAX_FILTER: {
DCHECK(param->request->has_minmax_filter());
return (*wrapper)->assign(&param->request->minmax_filter(), param->request->contain_null());
return (*wrapper)->assign(&param->request->minmax_filter(), param->request->contain_null(),
column_type);
}
default:
return Status::InternalError("unknown filter type");
Expand All @@ -1414,9 +1414,6 @@ Status IRuntimeFilter::_create_wrapper(const T* param,
std::unique_ptr<RuntimePredicateWrapper>* wrapper) {
int filter_type = param->request->filter_type();
PrimitiveType column_type = PrimitiveType::INVALID_TYPE;
if (param->request->has_in_filter()) {
column_type = to_primitive_type(param->request->in_filter().column_type());
}
if (param->request->has_column_type()) {
column_type = to_primitive_type(param->request->column_type());
}
Expand All @@ -1431,7 +1428,8 @@ Status IRuntimeFilter::_create_wrapper(const T* param,
switch (filter_type) {
case PFilterType::IN_FILTER: {
DCHECK(param->request->has_in_filter());
return (*wrapper)->assign(&param->request->in_filter(), param->request->contain_null());
return (*wrapper)->assign(&param->request->in_filter(), param->request->contain_null(),
column_type);
}
case PFilterType::BLOOM_FILTER: {
DCHECK(param->request->has_bloom_filter());
Expand All @@ -1442,7 +1440,8 @@ Status IRuntimeFilter::_create_wrapper(const T* param,
case PFilterType::MAX_FILTER:
case PFilterType::MINMAX_FILTER: {
DCHECK(param->request->has_minmax_filter());
return (*wrapper)->assign(&param->request->minmax_filter(), param->request->contain_null());
return (*wrapper)->assign(&param->request->minmax_filter(), param->request->contain_null(),
column_type);
}
default:
return Status::InternalError("unknown filter type");
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/exprs/vexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ TExprNode create_texpr_node_from(const void* data, const PrimitiveType& type, in
break;
}
default:
DCHECK(false);
throw std::invalid_argument("Invalid type!");
throw Exception(ErrorCode::INTERNAL_ERROR, "runtime filter meet invalid type {}",
int(type));
}
return node;
}
Expand Down
Loading