From 59fec14ba49da089524b01f11eccf0469f4f4403 Mon Sep 17 00:00:00 2001 From: jackylee-ch Date: Tue, 11 Oct 2022 14:20:37 +0800 Subject: [PATCH] use large buffer for hash agg --- .../src/codegen/arrow_compute/ext/hash_aggregate_kernel.cc | 6 +++--- native-sql-engine/cpp/src/precompile/hash_map.cc | 2 ++ native-sql-engine/cpp/src/precompile/hash_map.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/hash_aggregate_kernel.cc b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/hash_aggregate_kernel.cc index c648d8d9d..404a21cb2 100644 --- a/native-sql-engine/cpp/src/codegen/arrow_compute/ext/hash_aggregate_kernel.cc +++ b/native-sql-engine/cpp/src/codegen/arrow_compute/ext/hash_aggregate_kernel.cc @@ -45,7 +45,7 @@ namespace codegen { namespace arrowcompute { namespace extra { using ArrayList = std::vector>; -using precompile::StringHashMap; +using precompile::LargeStringHashMap; /////////////// HashAgg Kernel //////////////// class HashAggregateKernel::Impl { @@ -945,7 +945,7 @@ class HashAggregateKernel::Impl { pre_process_projector_(pre_process_projector), post_process_projector_(post_process_projector), action_impl_list_(action_impl_list) { - aggr_hash_table_ = std::make_shared(ctx->memory_pool()); + aggr_hash_table_ = std::make_shared(ctx->memory_pool()); #ifdef DEBUG std::cout << "using string hashagg res" << std::endl; #endif @@ -1072,7 +1072,7 @@ class HashAggregateKernel::Impl { private: arrow::compute::ExecContext* ctx_; std::vector> action_impl_list_; - std::shared_ptr aggr_hash_table_; + std::shared_ptr aggr_hash_table_; const std::vector& key_index_list_; const std::vector>& action_prepare_index_list_; std::shared_ptr pre_process_projector_; diff --git a/native-sql-engine/cpp/src/precompile/hash_map.cc b/native-sql-engine/cpp/src/precompile/hash_map.cc index 25535605b..6f2db7030 100644 --- a/native-sql-engine/cpp/src/precompile/hash_map.cc +++ b/native-sql-engine/cpp/src/precompile/hash_map.cc @@ -113,6 +113,8 @@ TYPED_ARROW_HASH_MAP_IMPL(Date32HashMap, Date32Type, int32_t, Date32MemoTableTyp TYPED_ARROW_HASH_MAP_IMPL(Date64HashMap, Date64Type, int64_t, Date64MemoTableType) TYPED_ARROW_HASH_MAP_BINARY_IMPL(StringHashMap, StringType, arrow::util::string_view, StringMemoTableType) +TYPED_ARROW_HASH_MAP_BINARY_IMPL(LargeStringHashMap, LargeStringType, + arrow::util::string_view, LargeStringMemoTableType) TYPED_ARROW_HASH_MAP_DECIMAL_IMPL(Decimal128HashMap, Decimal128Type, arrow::Decimal128, DecimalMemoTableType) #undef TYPED_ARROW_HASH_MAP_IMPL diff --git a/native-sql-engine/cpp/src/precompile/hash_map.h b/native-sql-engine/cpp/src/precompile/hash_map.h index 43fa95eb5..e43a056cf 100644 --- a/native-sql-engine/cpp/src/precompile/hash_map.h +++ b/native-sql-engine/cpp/src/precompile/hash_map.h @@ -47,6 +47,7 @@ TYPED_HASH_MAP_DEFINE(DoubleHashMap, double) TYPED_HASH_MAP_DEFINE(Date32HashMap, int32_t) TYPED_HASH_MAP_DEFINE(Date64HashMap, int64_t) TYPED_HASH_MAP_DEFINE(StringHashMap, arrow::util::string_view) +TYPED_HASH_MAP_DEFINE(LargeStringHashMap, arrow::util::string_view) TYPED_HASH_MAP_DEFINE(Decimal128HashMap, arrow::Decimal128) #undef TYPED_HASH_MAP_DEFINE } // namespace precompile