HappenLee commented on code in PR #66455:
URL: https://github.com/apache/doris/pull/66455#discussion_r3803990242
##########
be/src/exprs/expr_zonemap_filter.cpp:
##########
@@ -194,42 +190,30 @@ TExprNode create_texpr_node_from_hybrid_set_value(const
void* data, const Primit
return create_texpr_node_from(data, type, precision, scale);
}
-Status materialize_hybrid_set_for_zonemap_filter(HybridSetBase& set, const
DataTypePtr& data_type,
- InZonemapMaterializedSet*
result) {
- DORIS_CHECK(result != nullptr);
+void get_hybrid_set_min_max_for_zonemap_filter(const
std::shared_ptr<HybridSetBase>& set,
+ const DataTypePtr& data_type,
+ InZonemapMinMax& result) {
+ DORIS_CHECK(set != nullptr);
DORIS_CHECK(data_type != nullptr);
const auto value_type = remove_nullable(data_type);
DORIS_CHECK(value_type != nullptr);
- result->contains_null = set.contain_null();
- result->contains_nan = false;
- result->values.clear();
- result->min_value = Field();
- result->max_value = Field();
-
- auto* iterator = set.begin();
- while (iterator->has_next()) {
- const void* value = iterator->get_value();
- if (value != nullptr) {
- TExprNode literal_node = create_texpr_node_from_hybrid_set_value(
- value, value_type->get_primitive_type(),
value_type->get_precision(),
- value_type->get_scale());
- auto literal = VLiteral::create_shared(literal_node);
- Field field;
- literal->get_column_ptr()->get(0, field);
- result->contains_nan |= field.is_nan();
- result->values.emplace_back(std::move(field));
+ result.contains_nan = set->contains_nan();
+ set->get_min_max(result.min_value, result.max_value);
Review Comment:
这两个操作都要遍历一遍集合,这个集合能不能考虑只遍历一次就拿到这三个值?
--
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]