Mryange commented on code in PR #31913:
URL: https://github.com/apache/doris/pull/31913#discussion_r1522960359
##########
be/src/vec/aggregate_functions/aggregate_function_map.h:
##########
@@ -135,13 +135,44 @@ struct AggregateFunctionMapAggData {
num_rows);
dst_key_column.get_nested_column().insert_range_from(*_key_column, 0,
num_rows);
dst.get_values().insert_range_from(*_value_column, 0, num_rows);
- if (offsets.size() == 0) {
+ if (offsets.empty()) {
offsets.push_back(num_rows);
} else {
offsets.push_back(offsets.back() + num_rows);
}
}
+ void write(BufferWritable& buf) const {
+ const size_t size = _key_column->size();
+ write_binary(size, buf);
+ for (size_t i = 0; i < size; i++) {
+
write_binary(assert_cast<KeyColumnType&>(*_key_column).get_data_at(i), buf);
+ }
+ for (size_t i = 0; i < size; i++) {
+ write_binary(_value_column->get_data_at(i), buf);
+ }
+ }
+
+ void read(BufferReadable& buf) {
+ size_t size = 0;
+ read_binary(size, buf);
+ std::string keys;
+ for (size_t i = 0; i < size; i++) {
+ read_binary(keys, buf);
+ StringRef key {keys};
+ if (_map.find(key) != _map.cend()) {
Review Comment:
do nothingļ¼ the map aggregation function assumed that keys cannot be
duplicated, so if there are duplicates, they should not be placed in the map.
--
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]