mrhhsg commented on code in PR #68426:
URL: https://github.com/apache/doris/pull/68426#discussion_r4208068349


##########
be/src/exprs/aggregate/aggregate_function_map_v2.cpp:
##########
@@ -56,16 +59,30 @@ AggregateFunctionPtr 
create_aggregate_function_map_agg_v2(const std::string& nam
     case PrimitiveType::TYPE_TIMESTAMP_NS:
     case PrimitiveType::TYPE_TIMEV2:
     case PrimitiveType::TYPE_TIMESTAMPTZ:
-        return create_agg_function_map_agg_v2(argument_types, 
result_is_nullable, attr);
+        return 
create_agg_function_map_agg_v2<use_exact_key_frame>(argument_types,
+                                                                   
result_is_nullable, attr);
+    case PrimitiveType::TYPE_IPV4:
+    case PrimitiveType::TYPE_IPV6:
+        if constexpr (use_exact_key_frame) {
+            return 
create_agg_function_map_agg_v2<use_exact_key_frame>(argument_types,
+                                                                       
result_is_nullable, attr);
+        }
+        break;
     default:
-        LOG(WARNING) << fmt::format("unsupported input type {} for aggregate 
function {}",
-                                    argument_types[0]->get_name(), name);
-        return nullptr;
+        break;
     }
+    LOG(WARNING) << fmt::format("unsupported input type {} for aggregate 
function {}",
+                                argument_types[0]->get_name(), name);
+    return nullptr;
 }
 
 void register_aggregate_function_map_agg_v2(AggregateFunctionSimpleFactory& 
factory) {
-    factory.register_function_both("map_agg_v2", 
create_aggregate_function_map_agg_v2);
+    factory.register_function_both("map_agg_v2", 
create_aggregate_function_map_agg_v2<true>);
+    constexpr auto old_be_exec_version = 
SUPPORT_MAP_AGG_V2_EXACT_FRAME_VERSION - 1;
+    factory.register_alternative_function("map_agg_v2", 
create_aggregate_function_map_agg_v2<false>,

Review Comment:
   Fixed by cbc87d2 and covered in b03610b. Transient alternative registration 
now routes the legacy wire implementation without adding map_agg_v2 to the 
persisted-state incompatibility map. The new test_map_agg_v2_versioned_state 
regression creates and inserts an AGG_STATE<map_agg_v2> table at BE execution 
version 15, switches to version 16, reads the stored Map state, performs full 
compaction (verifying the data-rowset count decreases), and reads it again. The 
generated-output run and a normal rerun both passed in an isolated ASAN cluster.



##########
be/src/exprs/aggregate/aggregate_function_map_v2.cpp:
##########
@@ -56,16 +59,30 @@ AggregateFunctionPtr 
create_aggregate_function_map_agg_v2(const std::string& nam
     case PrimitiveType::TYPE_TIMESTAMP_NS:
     case PrimitiveType::TYPE_TIMEV2:
     case PrimitiveType::TYPE_TIMESTAMPTZ:
-        return create_agg_function_map_agg_v2(argument_types, 
result_is_nullable, attr);
+        return 
create_agg_function_map_agg_v2<use_exact_key_frame>(argument_types,
+                                                                   
result_is_nullable, attr);
+    case PrimitiveType::TYPE_IPV4:
+    case PrimitiveType::TYPE_IPV6:
+        if constexpr (use_exact_key_frame) {
+            return 
create_agg_function_map_agg_v2<use_exact_key_frame>(argument_types,
+                                                                       
result_is_nullable, attr);
+        }
+        break;
     default:
-        LOG(WARNING) << fmt::format("unsupported input type {} for aggregate 
function {}",
-                                    argument_types[0]->get_name(), name);
-        return nullptr;
+        break;
     }
+    LOG(WARNING) << fmt::format("unsupported input type {} for aggregate 
function {}",
+                                argument_types[0]->get_name(), name);
+    return nullptr;
 }
 
 void register_aggregate_function_map_agg_v2(AggregateFunctionSimpleFactory& 
factory) {
-    factory.register_function_both("map_agg_v2", 
create_aggregate_function_map_agg_v2);
+    factory.register_function_both("map_agg_v2", 
create_aggregate_function_map_agg_v2<true>);
+    constexpr auto old_be_exec_version = 
SUPPORT_MAP_AGG_V2_EXACT_FRAME_VERSION - 1;
+    factory.register_alternative_function("map_agg_v2", 
create_aggregate_function_map_agg_v2<false>,
+                                          false, old_be_exec_version);
+    factory.register_alternative_function("map_agg_v2", 
create_aggregate_function_map_agg_v2<false>,

Review Comment:
   Fixed by cbc87d2 and covered in b03610b. The foreach-v2 creator now passes 
the negotiated attr.be_exec_version to get_nested, so a version-15 query 
selects the legacy nested serializer on a new BE. The extended ASAN unit test 
exercises frames above the compression threshold: it distinguishes version-15 
and version-16 frame sizes, round-trips each through an independently 
constructed wrapper, and decodes a version-15 old-format nested state inside a 
foreach envelope with the new BE version-15 receiver. All 7 focused BE tests 
pass. The old-peer side is simulated in the unit test rather than run as a 
separate old BE binary.



-- 
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]

Reply via email to