Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement HISTOGRAM and MERGE_HISTOGRAM aggregations #14045

Merged
merged 114 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
e385fda
Add `COUNT_FREQUENCY` and `MERGE_FREQUENCY` aggregations
ttnghia Sep 6, 2023
e3df8d4
Change the new aggregations to `HISTOGRAM` and `MERGE_HISTOGRAM`
ttnghia Sep 6, 2023
7bc7f91
Update copyright year
ttnghia Sep 7, 2023
0fd2000
Implement interface for the new aggregations
ttnghia Sep 7, 2023
1b04436
Add new files
ttnghia Sep 7, 2023
1977d69
Add skeleton APIs
ttnghia Sep 11, 2023
6fa93fc
Extract hash_reduce_by_row
ttnghia Sep 11, 2023
d11dd7f
Adopt `hash_reduce_by_row` in `distinct_reduce`
ttnghia Sep 12, 2023
b632570
Merge branch 'branch-23.10' into percentile
ttnghia Sep 12, 2023
e58f3e3
Rename struct and simplify code
ttnghia Sep 12, 2023
3cf1948
Refactor `hash_reduce_by_row`
ttnghia Sep 12, 2023
8488646
Rewrite `hash_reduce_by_row.cuh`
ttnghia Sep 12, 2023
1994684
Rename and rewrite `distinct_reduce.hpp`
ttnghia Sep 12, 2023
5dcbac9
Rewrite `distinct.cu`
ttnghia Sep 12, 2023
6236fcc
Rewrite `distinct_reduce.cu`
ttnghia Sep 12, 2023
42a778f
Rewrite `hash_reduce_by_row.cuh`
ttnghia Sep 12, 2023
584ff8d
Minor changes
ttnghia Sep 12, 2023
4a3d60d
Fix style
ttnghia Sep 12, 2023
4e74119
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 12, 2023
34cb488
Fix comment
ttnghia Sep 12, 2023
c863b53
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 12, 2023
e73c07f
Move file
ttnghia Sep 12, 2023
40e8730
Merge `distinct_reduce.*` into `distinct.cu`
ttnghia Sep 12, 2023
95e4463
Move file
ttnghia Sep 12, 2023
723ae4c
Merge `distinct_reduce.*` into `distinct.cu`
ttnghia Sep 12, 2023
921243e
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 12, 2023
8fb7a9e
Revert "Merge `distinct_reduce.*` into `distinct.cu`"
ttnghia Sep 12, 2023
65427c8
Rename function
ttnghia Sep 12, 2023
bcc2db4
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 12, 2023
0c0c7ac
Fix output type
ttnghia Sep 12, 2023
c066276
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 12, 2023
01cc1c2
Move file
ttnghia Sep 13, 2023
f5a6a1a
Rename function
ttnghia Sep 13, 2023
dfbb720
Merge branch 'refactor_hash_reduce' into percentile
ttnghia Sep 13, 2023
924a2d6
Implement histogram reduction
ttnghia Sep 13, 2023
a1b516e
Support partial count
ttnghia Sep 13, 2023
e196ab4
Return list scalar of structs
ttnghia Sep 13, 2023
09f68af
Add factory functions for histogram and merge histogram
ttnghia Sep 13, 2023
f107d98
Fix aggregation dispatcher
ttnghia Sep 13, 2023
cc185d8
Fix bug
ttnghia Sep 13, 2023
547be01
Working test
ttnghia Sep 13, 2023
4d93b1e
Implement merge histogram
ttnghia Sep 13, 2023
6d8be79
Add test for merge histogram
ttnghia Sep 13, 2023
2d08539
Cleanup
ttnghia Sep 13, 2023
7999c7e
Cleanup
ttnghia Sep 13, 2023
2d47048
Add tests with nulls
ttnghia Sep 13, 2023
824dcad
Add sliced input tests
ttnghia Sep 13, 2023
3fb43f4
Fix sliced input
ttnghia Sep 13, 2023
ee229a0
Add binding for `HISTOGRAM` and `MERGE_HISTOGRAM` aggregations
ttnghia Sep 13, 2023
0ece05d
Merge branch 'branch-23.10' into percentile
ttnghia Sep 14, 2023
b71c7a8
Fix compiling issue
ttnghia Sep 14, 2023
1edeb4c
Remove header
ttnghia Sep 14, 2023
75c35c4
Change test types
ttnghia Sep 15, 2023
35f6374
Merge branch 'jni_histogram' into percentile
ttnghia Sep 18, 2023
c6c2c43
Rewrite tests
ttnghia Sep 18, 2023
b5dd22a
Misc
ttnghia Sep 18, 2023
17b8975
Cleanup
ttnghia Sep 18, 2023
c0b245f
Revert changes
ttnghia Sep 18, 2023
a8b3696
Add more assert statements
ttnghia Sep 18, 2023
a7fee30
Clean up tests
ttnghia Sep 18, 2023
829017a
Add docs
ttnghia Sep 18, 2023
e53042e
Rewrite docs
ttnghia Sep 18, 2023
49608ab
Add a helper file
ttnghia Sep 18, 2023
08aac0e
Rewrite histogram
ttnghia Sep 18, 2023
aaaf347
Add docs
ttnghia Sep 18, 2023
2f5b343
Remove file
ttnghia Sep 18, 2023
c11f939
Rewrite docs
ttnghia Sep 18, 2023
d10842e
Change docs
ttnghia Sep 18, 2023
6abc7b5
Add headers
ttnghia Sep 19, 2023
f833f58
Implement groupby histogram and merge histogram aggs
ttnghia Sep 19, 2023
ef308e8
Update header copyright
ttnghia Sep 19, 2023
70e624d
Rename function
ttnghia Sep 19, 2023
ee91b2e
Fix typos
ttnghia Sep 19, 2023
7c51faa
Add file
ttnghia Sep 19, 2023
270bcb8
Add docs
ttnghia Sep 19, 2023
6447877
Add empty tests
ttnghia Sep 19, 2023
c766e43
Implement histogram tests
ttnghia Sep 19, 2023
baddf18
Move tests
ttnghia Sep 20, 2023
0afad9c
Rename alias
ttnghia Sep 20, 2023
c05e595
Add target types
ttnghia Sep 20, 2023
8653053
Add empty return
ttnghia Sep 20, 2023
8d6fdfe
MISC
ttnghia Sep 20, 2023
d1fbda4
Add more assertions
ttnghia Sep 20, 2023
199d97b
Implement unit tests for groupby histogram
ttnghia Sep 20, 2023
4b0983e
Reimplement merge histogram
ttnghia Sep 20, 2023
0a8a03d
Implement unit tests for merge histogram
ttnghia Sep 20, 2023
201d432
Fix empty output for merge histogram
ttnghia Sep 20, 2023
edf6816
Fix empty input test
ttnghia Sep 20, 2023
8ac649e
Remove comment
ttnghia Sep 20, 2023
04965fa
Cleanup
ttnghia Sep 20, 2023
63ef1fa
Fix docs
ttnghia Sep 20, 2023
d31de20
Rewrite docs
ttnghia Sep 20, 2023
34a4268
Rewrite histogram.cu
ttnghia Sep 20, 2023
502a3da
Fix typo
ttnghia Sep 20, 2023
61377e0
Fix header
ttnghia Sep 20, 2023
dd72159
Revert changes
ttnghia Sep 20, 2023
56516e9
Merge branch 'branch-23.10' into percentile
ttnghia Sep 20, 2023
00c9c79
Merge remote-tracking branch 'nghia/percentile' into percentile
ttnghia Sep 21, 2023
424196b
Add empty input handling
ttnghia Sep 21, 2023
26238dd
Rename function and change return type
ttnghia Sep 21, 2023
5001cbd
Merge remote-tracking branch 'nghia/percentile' into percentile
ttnghia Sep 21, 2023
76f77a0
Format
ttnghia Sep 21, 2023
39ce6d1
Merge remote-tracking branch 'nghia/percentile' into percentile
ttnghia Sep 21, 2023
ad09d30
Revert "Add binding for `HISTOGRAM` and `MERGE_HISTOGRAM` aggregations"
ttnghia Sep 21, 2023
e12df0f
Rename function, remove histogram output dtype
ttnghia Sep 21, 2023
b06ed2a
Move header
ttnghia Sep 21, 2023
b6b720a
Fix docs
ttnghia Sep 21, 2023
b30f70c
Move detail header file, use `std::invalid_argument`, and some comments
ttnghia Sep 26, 2023
89f3628
Move header file and fix comment
ttnghia Sep 26, 2023
c3ad104
Append enum
ttnghia Sep 26, 2023
f504c86
Redeclare `hash_table_allocator_type`
ttnghia Sep 26, 2023
e9d723e
Temporarily fail on nested input
ttnghia Sep 26, 2023
d1980e0
Merge branch 'branch-23.10' into percentile
ttnghia Sep 27, 2023
83b8a37
Fix compile issue due to merge conflict
ttnghia Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ add_library(
src/groupby/sort/group_collect.cu
src/groupby/sort/group_correlation.cu
src/groupby/sort/group_count.cu
src/groupby/sort/group_histogram.cu
src/groupby/sort/group_m2.cu
src/groupby/sort/group_max.cu
src/groupby/sort/group_min.cu
Expand Down Expand Up @@ -471,6 +472,7 @@ add_library(
src/reductions/all.cu
src/reductions/any.cu
src/reductions/collect_ops.cu
src/reductions/histogram.cu
src/reductions/max.cu
src/reductions/mean.cu
src/reductions/min.cu
Expand Down
22 changes: 20 additions & 2 deletions cpp/include/cudf/aggregation.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -116,7 +116,9 @@ class aggregation {
COVARIANCE, ///< covariance between two sets of elements
CORRELATION, ///< correlation between two sets of elements
TDIGEST, ///< create a tdigest from a set of input values
MERGE_TDIGEST ///< create a tdigest by merging multiple tdigests together
MERGE_TDIGEST, ///< create a tdigest by merging multiple tdigests together
HISTOGRAM, ///< compute frequency of each element
MERGE_HISTOGRAM ///< merge partial values of HISTOGRAM aggregation,
};

aggregation() = delete;
Expand Down Expand Up @@ -288,6 +290,11 @@ std::unique_ptr<Base> make_any_aggregation();
template <typename Base = aggregation>
std::unique_ptr<Base> make_all_aggregation();

/// Factory to create a HISTOGRAM aggregation
/// @return A HISTOGRAM aggregation object
template <typename Base = aggregation>
std::unique_ptr<Base> make_histogram_aggregation();

/// Factory to create a SUM_OF_SQUARES aggregation
/// @return A SUM_OF_SQUARES aggregation object
template <typename Base = aggregation>
Expand Down Expand Up @@ -610,6 +617,17 @@ std::unique_ptr<Base> make_merge_sets_aggregation(
template <typename Base = aggregation>
std::unique_ptr<Base> make_merge_m2_aggregation();

/**
* @brief Factory to create a MERGE_HISTOGRAM aggregation
*
* Merges the results of `HISTOGRAM` aggregations on independent sets into a new `HISTOGRAM` value
* equivalent to if a single `HISTOGRAM` aggregation was done across all of the sets at once.
*
* @return A MERGE_HISTOGRAM aggregation object
*/
template <typename Base = aggregation>
std::unique_ptr<Base> make_merge_histogram_aggregation();

/**
* @brief Factory to create a COVARIANCE aggregation
*
Expand Down
60 changes: 60 additions & 0 deletions cpp/include/cudf/detail/aggregation/aggregation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class simple_aggregations_collector { // Declares the interface for the simple
class max_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
class count_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
class histogram_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
class any_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
Expand Down Expand Up @@ -89,6 +91,8 @@ class simple_aggregations_collector { // Declares the interface for the simple
class merge_sets_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
class merge_m2_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(
data_type col_type, class merge_histogram_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
class covariance_aggregation const& agg);
virtual std::vector<std::unique_ptr<aggregation>> visit(data_type col_type,
Expand All @@ -108,6 +112,7 @@ class aggregation_finalizer { // Declares the interface for the finalizer
virtual void visit(class min_aggregation const& agg);
virtual void visit(class max_aggregation const& agg);
virtual void visit(class count_aggregation const& agg);
virtual void visit(class histogram_aggregation const& agg);
virtual void visit(class any_aggregation const& agg);
virtual void visit(class all_aggregation const& agg);
virtual void visit(class sum_of_squares_aggregation const& agg);
Expand All @@ -130,6 +135,7 @@ class aggregation_finalizer { // Declares the interface for the finalizer
virtual void visit(class merge_lists_aggregation const& agg);
virtual void visit(class merge_sets_aggregation const& agg);
virtual void visit(class merge_m2_aggregation const& agg);
virtual void visit(class merge_histogram_aggregation const& agg);
virtual void visit(class covariance_aggregation const& agg);
virtual void visit(class correlation_aggregation const& agg);
virtual void visit(class tdigest_aggregation const& agg);
Expand Down Expand Up @@ -251,6 +257,25 @@ class count_aggregation final : public rolling_aggregation,
void finalize(aggregation_finalizer& finalizer) const override { finalizer.visit(*this); }
};

/**
* @brief Derived class for specifying a histogram aggregation
*/
class histogram_aggregation final : public groupby_aggregation, public reduce_aggregation {
public:
histogram_aggregation() : aggregation(HISTOGRAM) {}

[[nodiscard]] std::unique_ptr<aggregation> clone() const override
{
return std::make_unique<histogram_aggregation>(*this);
}
std::vector<std::unique_ptr<aggregation>> get_simple_aggregations(
data_type col_type, simple_aggregations_collector& collector) const override
{
return collector.visit(col_type, *this);
}
void finalize(aggregation_finalizer& finalizer) const override { finalizer.visit(*this); }
};

/**
* @brief Derived class for specifying an any aggregation
*/
Expand Down Expand Up @@ -972,6 +997,25 @@ class merge_m2_aggregation final : public groupby_aggregation {
void finalize(aggregation_finalizer& finalizer) const override { finalizer.visit(*this); }
};

/**
* @brief Derived aggregation class for specifying MERGE_HISTOGRAM aggregation
*/
class merge_histogram_aggregation final : public groupby_aggregation, public reduce_aggregation {
public:
explicit merge_histogram_aggregation() : aggregation{MERGE_HISTOGRAM} {}

[[nodiscard]] std::unique_ptr<aggregation> clone() const override
{
return std::make_unique<merge_histogram_aggregation>(*this);
}
std::vector<std::unique_ptr<aggregation>> get_simple_aggregations(
data_type col_type, simple_aggregations_collector& collector) const override
{
return collector.visit(col_type, *this);
}
void finalize(aggregation_finalizer& finalizer) const override { finalizer.visit(*this); }
};

/**
* @brief Derived aggregation class for specifying COVARIANCE aggregation
*/
Expand Down Expand Up @@ -1148,6 +1192,12 @@ struct target_type_impl<Source, aggregation::COUNT_ALL> {
using type = size_type;
};

// Use list for HISTOGRAM
template <typename SourceType>
struct target_type_impl<SourceType, aggregation::HISTOGRAM> {
using type = list_view;
};

// Computing ANY of any type, use bool accumulator
template <typename Source>
struct target_type_impl<Source, aggregation::ANY> {
Expand Down Expand Up @@ -1326,6 +1376,12 @@ struct target_type_impl<SourceType, aggregation::MERGE_M2> {
using type = struct_view;
};

// Use list for MERGE_HISTOGRAM
template <typename SourceType>
struct target_type_impl<SourceType, aggregation::MERGE_HISTOGRAM> {
using type = list_view;
};

// Always use double for COVARIANCE
template <typename SourceType>
struct target_type_impl<SourceType, aggregation::COVARIANCE> {
Expand Down Expand Up @@ -1417,6 +1473,8 @@ CUDF_HOST_DEVICE inline decltype(auto) aggregation_dispatcher(aggregation::Kind
return f.template operator()<aggregation::COUNT_VALID>(std::forward<Ts>(args)...);
case aggregation::COUNT_ALL:
return f.template operator()<aggregation::COUNT_ALL>(std::forward<Ts>(args)...);
case aggregation::HISTOGRAM:
return f.template operator()<aggregation::HISTOGRAM>(std::forward<Ts>(args)...);
case aggregation::ANY:
return f.template operator()<aggregation::ANY>(std::forward<Ts>(args)...);
case aggregation::ALL:
Expand Down Expand Up @@ -1460,6 +1518,8 @@ CUDF_HOST_DEVICE inline decltype(auto) aggregation_dispatcher(aggregation::Kind
return f.template operator()<aggregation::MERGE_SETS>(std::forward<Ts>(args)...);
case aggregation::MERGE_M2:
return f.template operator()<aggregation::MERGE_M2>(std::forward<Ts>(args)...);
case aggregation::MERGE_HISTOGRAM:
return f.template operator()<aggregation::MERGE_HISTOGRAM>(std::forward<Ts>(args)...);
case aggregation::COVARIANCE:
return f.template operator()<aggregation::COVARIANCE>(std::forward<Ts>(args)...);
case aggregation::CORRELATION:
Expand Down
4 changes: 4 additions & 0 deletions cpp/include/cudf/detail/hash_reduce_by_row.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

#include <cudf/table/experimental/row_operators.cuh>
#include <cudf/types.hpp>
#include <hash/hash_allocator.cuh>
#include <hash/helper_functions.cuh>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/device_uvector.hpp>
#include <rmm/exec_policy.hpp>
#include <rmm/mr/device/polymorphic_allocator.hpp>

#include <thrust/for_each.h>
#include <thrust/iterator/counting_iterator.h>
Expand All @@ -29,6 +32,7 @@

namespace cudf::detail {

using hash_table_allocator_type = rmm::mr::stream_allocator_adaptor<default_allocator<char>>;
using hash_map_type =
cuco::static_map<size_type, size_type, cuda::thread_scope_device, hash_table_allocator_type>;

Expand Down
57 changes: 57 additions & 0 deletions cpp/include/cudf/reduction/detail/histogram.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <cudf/column/column_view.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/table/table_view.hpp>

#include <rmm/cuda_stream_view.hpp>
#include <rmm/device_uvector.hpp>

#include <memory>
#include <optional>

namespace cudf::reduction::detail {

/**
* @brief Compute the frequency for each distinct row in the input table.
*
* @param input The input table to compute histogram
* @param partial_counts An optional column containing count for each row
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate memory of the returned objects
* @return A pair of array contains the (stable-order) indices of the distinct rows in the input
* table, and their corresponding distinct counts
*/
[[nodiscard]] std::pair<std::unique_ptr<rmm::device_uvector<size_type>>, std::unique_ptr<column>>
compute_row_frequencies(table_view const& input,
std::optional<column_view> const& partial_counts,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Create an empty histogram column.
*
* A histogram column is a structs column `STRUCT<T, int64_t>` where T is type of the input
* values.
*
* @returns An empty histogram column
*/
[[nodiscard]] std::unique_ptr<column> make_empty_histogram_like(column_view const& values);

} // namespace cudf::reduction::detail
27 changes: 27 additions & 0 deletions cpp/include/cudf/reduction/detail/reduction_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,33 @@ std::unique_ptr<scalar> all(column_view const& col,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Compute frequency for each unique element in the input column.
*
* The result histogram is stored in structs column having two children. The first child contains
* unique elements from the input, and the second child contains their corresponding frequencies.
*
* @param input The column to compute histogram
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned scalar's device memory
* @return A list_scalar storing a structs column as the result histogram
PointKernel marked this conversation as resolved.
Show resolved Hide resolved
*/
std::unique_ptr<scalar> histogram(column_view const& input,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Merge multiple histograms together.
*
* @param input The input given as multiple histograms concatenated together
* @param stream CUDA stream used for device memory operations and kernel launches
* @param mr Device memory resource used to allocate the returned scalar's device memory
* @return A list_scalar storing the result histogram
*/
std::unique_ptr<scalar> merge_histogram(column_view const& input,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @brief Computes product of elements in input column
*
Expand Down
42 changes: 42 additions & 0 deletions cpp/src/aggregation/aggregation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
return visit(col_type, static_cast<aggregation const&>(agg));
}

std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
data_type col_type, histogram_aggregation const& agg)
{
return visit(col_type, static_cast<aggregation const&>(agg));
}

std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
data_type col_type, any_aggregation const& agg)
{
Expand Down Expand Up @@ -196,6 +202,12 @@ std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
return visit(col_type, static_cast<aggregation const&>(agg));
}

std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
data_type col_type, merge_histogram_aggregation const& agg)
{
return visit(col_type, static_cast<aggregation const&>(agg));
}

std::vector<std::unique_ptr<aggregation>> simple_aggregations_collector::visit(
data_type col_type, covariance_aggregation const& agg)
{
Expand Down Expand Up @@ -246,6 +258,10 @@ void aggregation_finalizer::visit(count_aggregation const& agg)
{
visit(static_cast<aggregation const&>(agg));
}
void aggregation_finalizer::visit(histogram_aggregation const& agg)
{
visit(static_cast<aggregation const&>(agg));
}

void aggregation_finalizer::visit(any_aggregation const& agg)
{
Expand Down Expand Up @@ -357,6 +373,11 @@ void aggregation_finalizer::visit(merge_m2_aggregation const& agg)
visit(static_cast<aggregation const&>(agg));
}

void aggregation_finalizer::visit(merge_histogram_aggregation const& agg)
{
visit(static_cast<aggregation const&>(agg));
}

void aggregation_finalizer::visit(covariance_aggregation const& agg)
{
visit(static_cast<aggregation const&>(agg));
Expand Down Expand Up @@ -460,6 +481,16 @@ template std::unique_ptr<groupby_aggregation> make_count_aggregation<groupby_agg
template std::unique_ptr<groupby_scan_aggregation> make_count_aggregation<groupby_scan_aggregation>(
null_policy null_handling);

/// Factory to create a HISTOGRAM aggregation
template <typename Base>
std::unique_ptr<Base> make_histogram_aggregation()
{
return std::make_unique<detail::histogram_aggregation>();
}
template std::unique_ptr<aggregation> make_histogram_aggregation<aggregation>();
template std::unique_ptr<groupby_aggregation> make_histogram_aggregation<groupby_aggregation>();
template std::unique_ptr<reduce_aggregation> make_histogram_aggregation<reduce_aggregation>();

/// Factory to create a ANY aggregation
template <typename Base>
std::unique_ptr<Base> make_any_aggregation()
Expand Down Expand Up @@ -764,6 +795,17 @@ std::unique_ptr<Base> make_merge_m2_aggregation()
template std::unique_ptr<aggregation> make_merge_m2_aggregation<aggregation>();
template std::unique_ptr<groupby_aggregation> make_merge_m2_aggregation<groupby_aggregation>();

/// Factory to create a MERGE_HISTOGRAM aggregation
template <typename Base>
std::unique_ptr<Base> make_merge_histogram_aggregation()
{
return std::make_unique<detail::merge_histogram_aggregation>();
}
template std::unique_ptr<aggregation> make_merge_histogram_aggregation<aggregation>();
template std::unique_ptr<groupby_aggregation>
make_merge_histogram_aggregation<groupby_aggregation>();
template std::unique_ptr<reduce_aggregation> make_merge_histogram_aggregation<reduce_aggregation>();

/// Factory to create a COVARIANCE aggregation
template <typename Base>
std::unique_ptr<Base> make_covariance_aggregation(size_type min_periods, size_type ddof)
Expand Down
Loading
Loading