morningman commented on a change in pull request #7645:
URL: https://github.com/apache/incubator-doris/pull/7645#discussion_r785288046
##########
File path: be/src/exprs/runtime_filter.cpp
##########
@@ -351,6 +359,26 @@ class RuntimePredicateWrapper {
return Status::OK();
}
+ Status change_to_bloom_filter() {
+ if (_filter_type != RuntimeFilterType::IN_OR_BLOOM_FILTER) {
Review comment:
Looks like there is no where to check this Status?
And better not using `stringstream` in hot path.
##########
File path: be/src/exprs/runtime_filter.cpp
##########
@@ -439,9 +481,20 @@ class RuntimePredicateWrapper {
}
Status merge(const RuntimePredicateWrapper* wrapper) {
- DCHECK(_filter_type == wrapper->_filter_type);
- if (_filter_type != wrapper->_filter_type) {
- return Status::InvalidArgument("invalid filter type");
+ bool can_not_merge_in_or_bloom
+ = _filter_type == RuntimeFilterType::IN_OR_BLOOM_FILTER &&
+ (wrapper->_filter_type != RuntimeFilterType::IN_FILTER
+ && wrapper->_filter_type !=
RuntimeFilterType::BLOOM_FILTER);
+
+ bool can_not_merge_other = _filter_type !=
RuntimeFilterType::IN_OR_BLOOM_FILTER
+ && _filter_type != wrapper->_filter_type;
+
+ if (can_not_merge_in_or_bloom || can_not_merge_other) {
+ std::stringstream msg;
Review comment:
Do not using `stringstream` here.
Same as others
##########
File path: be/src/exprs/runtime_filter.cpp
##########
@@ -483,6 +536,63 @@ class RuntimePredicateWrapper {
_bloomfilter_func->merge(wrapper->_bloomfilter_func.get());
break;
}
+ case RuntimeFilterType::IN_OR_BLOOM_FILTER: {
+ auto real_filter_type = _is_bloomfilter
+ ? RuntimeFilterType::BLOOM_FILTER
+ : RuntimeFilterType::IN_FILTER;
+ if (real_filter_type == RuntimeFilterType::IN_FILTER) {
+ if (wrapper->_filter_type == RuntimeFilterType::IN_FILTER) {
// in merge in
+ if (wrapper->_is_ignored_in_filter) {
+ std::stringstream msg;
+ msg << "fragment instance " <<
_fragment_instance_id.to_string()
+ << " can not ignore merge runtime filter(in filter
id "
+ << wrapper->_filter_id << ") when used
IN_OR_BLOOM_FILTER, ignore msg: "
+ << *(wrapper->get_ignored_in_filter_msg());
+ return Status::InvalidArgument(msg.str());
+ }
+ _hybrid_set->insert(wrapper->_hybrid_set.get());
+ if (_max_in_num >= 0 && _hybrid_set->size() >=
_max_in_num) {
+ std::stringstream msg;
+ msg << "fragment instance " <<
_fragment_instance_id.to_string()
+ << " change runtime filter to bloom filter(id=" <<
_filter_id
+ << ") because: in_num(" << _hybrid_set->size()
+ << ") >= max_in_num(" << _max_in_num << ")";
+ LOG(INFO) << msg.str();
+ change_to_bloom_filter();
+ }
+ // in merge bloom filter
+ } else {
+ std::stringstream msg;
+ msg << "fragment instance " <<
_fragment_instance_id.to_string()
+ << " change runtime filter to bloom filter(id=" <<
_filter_id
+ << ") because: already exist a bloom filter";
+ LOG(INFO) << msg.str();
Review comment:
Do not print log here
##########
File path: be/src/exprs/runtime_filter.cpp
##########
@@ -483,6 +536,63 @@ class RuntimePredicateWrapper {
_bloomfilter_func->merge(wrapper->_bloomfilter_func.get());
break;
}
+ case RuntimeFilterType::IN_OR_BLOOM_FILTER: {
+ auto real_filter_type = _is_bloomfilter
+ ? RuntimeFilterType::BLOOM_FILTER
+ : RuntimeFilterType::IN_FILTER;
+ if (real_filter_type == RuntimeFilterType::IN_FILTER) {
+ if (wrapper->_filter_type == RuntimeFilterType::IN_FILTER) {
// in merge in
+ if (wrapper->_is_ignored_in_filter) {
+ std::stringstream msg;
+ msg << "fragment instance " <<
_fragment_instance_id.to_string()
+ << " can not ignore merge runtime filter(in filter
id "
+ << wrapper->_filter_id << ") when used
IN_OR_BLOOM_FILTER, ignore msg: "
+ << *(wrapper->get_ignored_in_filter_msg());
+ return Status::InvalidArgument(msg.str());
+ }
+ _hybrid_set->insert(wrapper->_hybrid_set.get());
+ if (_max_in_num >= 0 && _hybrid_set->size() >=
_max_in_num) {
+ std::stringstream msg;
+ msg << "fragment instance " <<
_fragment_instance_id.to_string()
+ << " change runtime filter to bloom filter(id=" <<
_filter_id
+ << ") because: in_num(" << _hybrid_set->size()
+ << ") >= max_in_num(" << _max_in_num << ")";
+ LOG(INFO) << msg.str();
Review comment:
Do not print log here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]