yiguolei commented on code in PR #62544:
URL: https://github.com/apache/doris/pull/62544#discussion_r3173939249
##########
be/src/storage/index/zone_map/zone_map_index.cpp:
##########
@@ -122,17 +122,47 @@
TypedZoneMapIndexWriter<Type>::TypedZoneMapIndexWriter(DataTypePtr&& data_type)
template <PrimitiveType Type>
void TypedZoneMapIndexWriter<Type>::_update_page_zonemap(const ValType&
min_value,
const ValType&
max_value) {
- auto min_field =
doris::Field::create_field_from_olap_value<Type>(min_value);
- auto max_field =
doris::Field::create_field_from_olap_value<Type>(max_value);
- if (!_page_zone_map.has_not_null || min_field < _page_zone_map.min_value) {
- _page_zone_map.min_value = std::move(min_field);
- }
- if (!_page_zone_map.has_not_null || max_field > _page_zone_map.max_value) {
- _page_zone_map.max_value = std::move(max_field);
+ // Hot path: compare/store using raw CppType to avoid Field temporaries.
+ // For string types, truncate to MAX_ZONE_MAP_INDEX_SIZE (matching the old
+ // Field-based path) and copy bytes into the arena so the StringRef stays
+ // valid across add_values() calls.
+ if constexpr (is_string_type(Type)) {
+ constexpr size_t kMaxZoneMapSize = MAX_ZONE_MAP_INDEX_SIZE;
Review Comment:
这个truncate的逻辑有点重复,在field::create_field_from_olap_value
这个方法里,也有truncate的逻辑。我觉得在field 里那个方法里truncate 是错误的,应该用你这个,所以你应该把field 里的truncate
删掉。
--
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]