HappenLee commented on code in PR #68312:
URL: https://github.com/apache/doris/pull/68312#discussion_r4142649116


##########
be/src/exprs/vectorized_fn_call.cpp:
##########
@@ -215,6 +217,33 @@ size_t raw_comparison_value_size(PrimitiveType 
primitive_type) {
     }
 }
 
+Status create_agg_state_finalize_function(const std::string& function_name,
+                                          const DataTypes& argument_types,
+                                          const DataTypePtr& return_type,
+                                          FunctionBasePtr& function) {
+    if (argument_types.size() != 1 ||
+        remove_nullable(argument_types[0])->get_primitive_type() != 
TYPE_AGG_STATE) {
+        return Status::InternalError("Finalize function requires one AGG_STATE 
argument");
+    }
+    const auto state_type = remove_nullable(argument_types[0]);
+    const auto* agg_state = assert_cast<const 
DataTypeAggState*>(state_type.get());
+    if (agg_state->get_function_name() + AGG_FINALIZE_SUFFIX != function_name) 
{
+        return Status::InternalError("{} does not match function {}", 
state_type->get_name(),
+                                     function_name);
+    }
+    const auto& nested = agg_state->get_nested_function();
+    auto expected_type = nested->get_return_type();
+    if (argument_types[0]->is_nullable()) {
+        expected_type = make_nullable(expected_type);
+    }
+    if (!expected_type->equals(*return_type)) {

Review Comment:
   `enable_decimal256` is disabled by default. Given that default 
configuration, I suggest treating the Decimal256-specific case as non-blocking 
for this PR and addressing Decimal256 AggState support separately.
   
   The runtime type-consistency check should remain in place. The decimal MAP 
case mentioned above is independent of this flag, so the default being disabled 
does not address that separate case.



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