github-actions[bot] commented on code in PR #66601:
URL: https://github.com/apache/doris/pull/66601#discussion_r3746880002


##########
be/src/exprs/aggregate/aggregate_function_array_agg.h:
##########
@@ -265,15 +268,27 @@ 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');
+        const auto* end =
+                column_type->serialize(*column_data, serialized_buffer.data(), 
be_exec_version);
+        DORIS_CHECK_LE(end, serialized_buffer.data() + serialized_bytes);
+        serialized_buffer.resize(end - serialized_buffer.data());
+        buf.write_binary(serialized_buffer);
     }
 
     void read(BufferReadable& buf) {
-        throw Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "array_agg not 
support read");
+        DORIS_CHECK(column_data->empty());
+        std::string serialized_buffer;
+        buf.read_binary(serialized_buffer);

Review Comment:
   **[P1] Preserve StreamVByte's readable tail for native states**
   
   Native numeric/nullable/string leaves above 256 bytes deserialize through 
`streamvbyte_decode()`, whose pinned v1.0.0 contract may read 
`STREAMVBYTE_PADDING` (16) bytes past the logical compressed end. The writer 
allocates that tail but frames only `end - data()`; this call then copies 
exactly the logical frame into a `std::string`, which does not guarantee 16 
readable bytes past `size()`. A nested nullable Int32 state with 65 values can 
therefore perform an out-of-bounds SIMD read during an ordinary two-phase 
merge. Please consume the existing length prefix and deserialize zero-copy from 
the original padded buffer (or explicitly copy logical size plus padding while 
keeping the framed length logical), then validate and advance by the logical 
length. Avoiding this overload also removes its separate 1 GiB `Too large 
string size` ceiling.



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