From efeb161cc601b25950546ab4b0c95a80e0638d74 Mon Sep 17 00:00:00 2001 From: Luc Rancourt Date: Tue, 29 Aug 2023 09:30:19 +0200 Subject: [PATCH] Remove template. --- test/src/test-cppapi-aggregates.cc | 4 +-- .../aggregators/null_count_aggregator.cc | 28 ++++--------------- .../aggregators/null_count_aggregator.h | 1 - .../test/compile_aggregators_main.cc | 22 +-------------- .../aggregators/test/unit_null_count.cc | 14 +++++----- 5 files changed, 15 insertions(+), 54 deletions(-) diff --git a/test/src/test-cppapi-aggregates.cc b/test/src/test-cppapi-aggregates.cc index 7ef6416d8aa..cd8443e70a9 100644 --- a/test/src/test-cppapi-aggregates.cc +++ b/test/src/test-cppapi-aggregates.cc @@ -1681,7 +1681,7 @@ TEMPLATE_LIST_TEST_CASE_METHOD( 1; query.ptr()->query_->add_aggregator_to_default_channel( "NullCount", - std::make_shared>( + std::make_shared( tiledb::sm::FieldInfo( "a1", false, @@ -1788,7 +1788,7 @@ TEST_CASE_METHOD( // TODO: Change to real CPPAPI. Add a count aggregator to the query. query.ptr()->query_->add_aggregator_to_default_channel( "NullCount", - std::make_shared>( + std::make_shared( tiledb::sm::FieldInfo( "a1", true, nullable_, TILEDB_VAR_NUM))); diff --git a/tiledb/sm/query/readers/aggregators/null_count_aggregator.cc b/tiledb/sm/query/readers/aggregators/null_count_aggregator.cc index fdaba16dd37..52b831a17ac 100644 --- a/tiledb/sm/query/readers/aggregators/null_count_aggregator.cc +++ b/tiledb/sm/query/readers/aggregators/null_count_aggregator.cc @@ -47,8 +47,7 @@ class NullCountAggregatorStatusException : public StatusException { } }; -template -NullCountAggregator::NullCountAggregator(const FieldInfo field_info) +NullCountAggregator::NullCountAggregator(const FieldInfo field_info) : field_info_(field_info) , null_count_(0) { if (!field_info_.is_nullable_) { @@ -57,8 +56,7 @@ NullCountAggregator::NullCountAggregator(const FieldInfo field_info) } } -template -void NullCountAggregator::validate_output_buffer( +void NullCountAggregator::validate_output_buffer( std::string output_field_name, std::unordered_map& buffers) { if (buffers.count(output_field_name) == 0) { @@ -89,8 +87,7 @@ void NullCountAggregator::validate_output_buffer( } } -template -void NullCountAggregator::aggregate_data(AggregateBuffer& input_data) { +void NullCountAggregator::aggregate_data(AggregateBuffer& input_data) { if (input_data.is_count_bitmap()) { null_count_ += null_count(input_data); } else { @@ -98,8 +95,7 @@ void NullCountAggregator::aggregate_data(AggregateBuffer& input_data) { } } -template -void NullCountAggregator::copy_to_user_buffer( +void NullCountAggregator::copy_to_user_buffer( std::string output_field_name, std::unordered_map& buffers) { auto& result_buffer = buffers[output_field_name]; @@ -110,9 +106,8 @@ void NullCountAggregator::copy_to_user_buffer( } } -template template -uint64_t NullCountAggregator::null_count(AggregateBuffer& input_data) { +uint64_t NullCountAggregator::null_count(AggregateBuffer& input_data) { uint64_t null_count{0}; // Run different loops for bitmap versus no bitmap. The bitmap tells us which @@ -141,18 +136,5 @@ uint64_t NullCountAggregator::null_count(AggregateBuffer& input_data) { return null_count; } -// Explicit template instantiations -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); -template NullCountAggregator::NullCountAggregator(const FieldInfo); - } // namespace sm } // namespace tiledb diff --git a/tiledb/sm/query/readers/aggregators/null_count_aggregator.h b/tiledb/sm/query/readers/aggregators/null_count_aggregator.h index c36a7266f15..49b41a6712f 100644 --- a/tiledb/sm/query/readers/aggregators/null_count_aggregator.h +++ b/tiledb/sm/query/readers/aggregators/null_count_aggregator.h @@ -45,7 +45,6 @@ namespace sm { class QueryBuffer; -template class NullCountAggregator : public IAggregator { public: /* ********************************* */ diff --git a/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc b/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc index a6b8902e6bd..d5291ea2e83 100644 --- a/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc +++ b/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc @@ -80,27 +80,7 @@ int main() { tiledb::sm::MaxAggregator( tiledb::sm::FieldInfo("MinMax", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( - tiledb::sm::FieldInfo("NullCount", false, false, 1)); - tiledb::sm::NullCountAggregator( + tiledb::sm::NullCountAggregator( tiledb::sm::FieldInfo("NullCount", false, false, 1)); tiledb::sm::SumAggregator( diff --git a/tiledb/sm/query/readers/aggregators/test/unit_null_count.cc b/tiledb/sm/query/readers/aggregators/test/unit_null_count.cc index 763faf38cee..8544c386ff4 100644 --- a/tiledb/sm/query/readers/aggregators/test/unit_null_count.cc +++ b/tiledb/sm/query/readers/aggregators/test/unit_null_count.cc @@ -44,7 +44,7 @@ TEST_CASE( "[null-count-aggregator][constructor]") { SECTION("Non nullable") { CHECK_THROWS_WITH( - NullCountAggregator(FieldInfo("a1", false, false, 1)), + NullCountAggregator(FieldInfo("a1", false, false, 1)), "NullCountAggregator: NullCount aggregates must only be requested for " "nullable attributes."); } @@ -53,27 +53,27 @@ TEST_CASE( TEST_CASE( "NullCount aggregator: var sized", "[null-count-aggregator][var-sized]") { bool var_sized = GENERATE(true, false); - NullCountAggregator aggregator(FieldInfo("a1", var_sized, true, 1)); + NullCountAggregator aggregator(FieldInfo("a1", var_sized, true, 1)); CHECK(aggregator.var_sized() == false); } TEST_CASE( "NullCount aggregator: need recompute", "[null-count-aggregator][need-recompute]") { - NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); + NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); CHECK(aggregator.need_recompute_on_overflow() == true); } TEST_CASE( "NullCount aggregator: field name", "[null-count-aggregator][field-name]") { - NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); + NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); CHECK(aggregator.field_name() == "a1"); } TEST_CASE( "NullCount aggregator: Validate buffer", "[null-count-aggregator][validate-buffer]") { - NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); + NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); std::unordered_map buffers; @@ -176,7 +176,7 @@ TEMPLATE_LIST_TEST_CASE( "[null-count-aggregator][basic-aggregation]", FixedTypesUnderTest) { typedef TestType T; - NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); + NullCountAggregator aggregator(FieldInfo("a1", false, true, 1)); std::unordered_map buffers; @@ -270,7 +270,7 @@ TEMPLATE_LIST_TEST_CASE( TEST_CASE( "NullCount aggregator: Basic string aggregation", "[null-count-aggregator][basic-string-aggregation]") { - NullCountAggregator aggregator( + NullCountAggregator aggregator( FieldInfo("a1", true, true, constants::var_num)); std::unordered_map buffers;