diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-01-30 16:57:39 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-01-30 16:57:39 +0300 |
commit | a696fc57c09dc44edd088a2fcd98e66c102e0ae2 (patch) | |
tree | 2510404af6b6564bee6261a56e3ea3bc1f3c720f | |
parent | 6fd86d7a8a8d3312cc9cf935a2c3e6ec50bb6009 (diff) | |
download | ydb-a696fc57c09dc44edd088a2fcd98e66c102e0ae2.tar.gz |
pack group key
-rw-r--r-- | ydb/library/arrow_clickhouse/Aggregator.cpp | 2 | ||||
-rw-r--r-- | ydb/library/arrow_clickhouse/Aggregator.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ydb/library/arrow_clickhouse/Aggregator.cpp b/ydb/library/arrow_clickhouse/Aggregator.cpp index 3f62b50a5b..d895a4cfca 100644 --- a/ydb/library/arrow_clickhouse/Aggregator.cpp +++ b/ydb/library/arrow_clickhouse/Aggregator.cpp @@ -162,6 +162,8 @@ AggregatedDataVariants::Type Aggregator::chooseAggregationMethod() { /// Pack if possible all the keys along with information about which key values are nulls /// into a fixed 16- or 32-byte blob. + if (std::tuple_size<KeysNullMap<UInt64>>::value + keys_bytes <= 8) + return AggregatedDataVariants::Type::nullable_keys64; if (std::tuple_size<KeysNullMap<UInt128>>::value + keys_bytes <= 16) return AggregatedDataVariants::Type::nullable_keys128; if (std::tuple_size<KeysNullMap<UInt256>>::value + keys_bytes <= 32) diff --git a/ydb/library/arrow_clickhouse/Aggregator.h b/ydb/library/arrow_clickhouse/Aggregator.h index 3f7dd7cf93..ab82e6ec31 100644 --- a/ydb/library/arrow_clickhouse/Aggregator.h +++ b/ydb/library/arrow_clickhouse/Aggregator.h @@ -52,6 +52,7 @@ using AggregatedDataWithShortStringKey = StringHashMap<AggregateDataPtr>; using AggregatedDataWithStringKey = HashMapWithSavedHash<StringRef, AggregateDataPtr>; +using AggregatedDataWithKeys64 = HashMap<UInt64, AggregateDataPtr, HashCRC32<UInt64>>; using AggregatedDataWithKeys128 = HashMap<UInt128, AggregateDataPtr, UInt128HashCRC32>; using AggregatedDataWithKeys256 = HashMap<UInt256, AggregateDataPtr, UInt256HashCRC32>; @@ -406,6 +407,7 @@ struct AggregatedDataVariants //: private boost::noncopyable std::unique_ptr<AggregationMethodSerialized<AggregatedDataWithStringKeyHash64>> serialized_hash64; /// Support for nullable keys. + std::unique_ptr<AggregationMethodKeysFixed<AggregatedDataWithKeys64, true>> nullable_keys64; std::unique_ptr<AggregationMethodKeysFixed<AggregatedDataWithKeys128, true>> nullable_keys128; std::unique_ptr<AggregationMethodKeysFixed<AggregatedDataWithKeys256, true>> nullable_keys256; @@ -429,6 +431,7 @@ struct AggregatedDataVariants //: private boost::noncopyable M(keys128_hash64) \ M(keys256_hash64) \ M(serialized_hash64) \ + M(nullable_keys64) \ M(nullable_keys128) \ M(nullable_keys256) \ |