HappenLee commented on code in PR #66601:
URL: https://github.com/apache/doris/pull/66601#discussion_r3748277015
##########
be/src/exprs/aggregate/aggregate_function_array_agg.h:
##########
@@ -234,11 +235,13 @@ struct AggregateFunctionArrayAggData<T> {
using ElementType = StringRef;
using Self = AggregateFunctionArrayAggData<T>;
MutableColumnPtr column_data;
+ DataTypePtr column_type;
Review Comment:
Fixed in 4d28bde19dd. You are right: the column type and BE execution
version are invariant aggregate-function metadata, so storing them in every
group/foreach state unnecessarily enlarged each state. The native-serde state
now contains only MutableColumnPtr, while serialize/deserialize receive the
type and version from the aggregate function. A static_assert locks this
state-size invariant.
##########
be/src/exprs/aggregate/aggregate_function_array_agg.h:
##########
@@ -265,15 +268,28 @@ struct AggregateFunctionArrayAggData<T> {
}
void write(BufferWritable& buf) const {
- throw Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "array_agg not
support write");
+ const auto serialized_bytes =
+ column_type->get_uncompressed_serialized_bytes(*column_data,
be_exec_version);
+ std::string serialized_buffer(serialized_bytes, '\0');
Review Comment:
Fixed in 4d28bde19dd. You are right: the temporary std::string duplicated
the full serialized payload and its allocation was outside the tracked
ColumnString destination. Native serialization now reserves padded destination
storage, serializes directly once, backfills the logical length, shrinks to the
exact frame, and restores the original buffer size if serialization throws.
Added a rollback test and a 2 MiB array_agg_foreach test that verifies the
destination allocation is memory-tracked; the focused ASAN run passes 13/13
tests.
--
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]