HappenLee commented on code in PR #22327:
URL: https://github.com/apache/doris/pull/22327#discussion_r1278888604
##########
be/src/vec/common/aggregation_common.h:
##########
@@ -218,6 +196,70 @@ T pack_fixed(size_t i, size_t keys_size, const
ColumnRawPtrs& key_columns, const
return key;
}
+template <typename T>
+std::vector<T> pack_fixeds(size_t row_numbers, const ColumnRawPtrs&
key_columns,
+ const Sizes& key_sizes, const ColumnRawPtrs&
nullmap_columns) {
+ size_t bitmap_size = 0;
+ if (!nullmap_columns.empty()) {
+ bitmap_size = std::tuple_size<KeysNullMap<T>>::value;
+ }
+
+ std::vector<T> result(row_numbers);
+ size_t offset = 0;
+ if (bitmap_size > 0) {
+ for (size_t j = 0; j < nullmap_columns.size(); j++) {
+ if (!nullmap_columns[j]) {
+ continue;
+ }
+ size_t bucket = j / 8;
+ size_t offset = j % 8;
+ const auto& data =
+ assert_cast<const
ColumnUInt8&>(*nullmap_columns[j]).get_data().data();
+ for (size_t i = 0; i < row_numbers; ++i) {
+ *((char*)(&result[i]) + bucket) |= data[i] << offset;
+ }
+ }
+ offset += bitmap_size;
+ }
+
+ for (size_t j = 0; j < key_columns.size(); ++j) {
+ const char* data = key_columns[j]->get_raw_data().data;
+
+ auto foo = [&]<typename Fixed>(Fixed zero) {
+ if (nullmap_columns.size() && nullmap_columns[j]) {
+ const auto& nullmap =
+ assert_cast<const
ColumnUInt8&>(*nullmap_columns[j]).get_data().data();
+ for (size_t i = 0; i < row_numbers; ++i) {
+ // make sure null cell is filled by 0x0
+ memcpy_fixed<Fixed>((char*)(&result[i]) + offset,
+ nullmap[i] ? (char*)&zero : data + i *
key_sizes[j]);
Review Comment:
`key_sizes[j]` replace by `sizeof(Fixed)`
--
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]