@@ -70,6 +70,15 @@ enum class rank_percentage : int32_t {
7070 ONE_NORMALIZED // /< (rank - 1) / (count - 1)
7171};
7272
73+ /* *
74+ * @brief Bitwise operations to use for BITWISE_AGG aggregations on numeric columns.
75+ */
76+ enum class bitwise_op : int32_t {
77+ AND, // /< bitwise AND operation
78+ OR, // /< bitwise OR operation
79+ XOR // /< bitwise XOR operation
80+ };
81+
7382/* *
7483 * @brief Abstract base class for specifying the desired aggregation in an
7584 * `aggregation_request`.
@@ -84,44 +93,45 @@ class aggregation {
8493 * @brief Possible aggregation operations
8594 */
8695 enum Kind {
87- SUM, // /< sum reduction
88- PRODUCT, // /< product reduction
89- MIN, // /< min reduction
90- MAX, // /< max reduction
91- COUNT_VALID, // /< count number of valid elements
92- COUNT_ALL, // /< count number of elements
93- ANY, // /< any reduction
94- ALL, // /< all reduction
95- SUM_OF_SQUARES, // /< sum of squares reduction
96- MEAN, // /< arithmetic mean reduction
97- M2, // /< sum of squares of differences from the mean
98- VARIANCE, // /< variance
99- STD, // /< standard deviation
100- MEDIAN, // /< median reduction
101- QUANTILE, // /< compute specified quantile(s)
102- ARGMAX, // /< Index of max element
103- ARGMIN, // /< Index of min element
104- NUNIQUE, // /< count number of unique elements
105- NTH_ELEMENT, // /< get the nth element
106- ROW_NUMBER, // /< get row-number of current index (relative to rolling window)
107- EWMA, // /< get exponential weighted moving average at current index
108- RANK, // /< get rank of current index
109- COLLECT_LIST, // /< collect values into a list
110- COLLECT_SET, // /< collect values into a list without duplicate entries
111- LEAD, // /< window function, accesses row at specified offset following current row
112- LAG, // /< window function, accesses row at specified offset preceding current row
113- PTX, // /< PTX based UDF aggregation
114- CUDA, // /< CUDA based UDF aggregation
115- HOST_UDF, // /< host based UDF aggregation
116- MERGE_LISTS, // /< merge multiple lists values into one list
117- MERGE_SETS, // /< merge multiple lists values into one list then drop duplicate entries
118- MERGE_M2, // /< merge partial values of M2 aggregation,
119- COVARIANCE, // /< covariance between two sets of elements
120- CORRELATION, // /< correlation between two sets of elements
121- TDIGEST, // /< create a tdigest from a set of input values
122- MERGE_TDIGEST, // /< create a tdigest by merging multiple tdigests together
123- HISTOGRAM, // /< compute frequency of each element
124- MERGE_HISTOGRAM // /< merge partial values of HISTOGRAM aggregation
96+ SUM, // /< sum reduction
97+ PRODUCT, // /< product reduction
98+ MIN, // /< min reduction
99+ MAX, // /< max reduction
100+ COUNT_VALID, // /< count number of valid elements
101+ COUNT_ALL, // /< count number of elements
102+ ANY, // /< any reduction
103+ ALL, // /< all reduction
104+ SUM_OF_SQUARES, // /< sum of squares reduction
105+ MEAN, // /< arithmetic mean reduction
106+ M2, // /< sum of squares of differences from the mean
107+ VARIANCE, // /< variance
108+ STD, // /< standard deviation
109+ MEDIAN, // /< median reduction
110+ QUANTILE, // /< compute specified quantile(s)
111+ ARGMAX, // /< Index of max element
112+ ARGMIN, // /< Index of min element
113+ NUNIQUE, // /< count number of unique elements
114+ NTH_ELEMENT, // /< get the nth element
115+ ROW_NUMBER, // /< get row-number of current index (relative to rolling window)
116+ EWMA, // /< get exponential weighted moving average at current index
117+ RANK, // /< get rank of current index
118+ COLLECT_LIST, // /< collect values into a list
119+ COLLECT_SET, // /< collect values into a list without duplicate entries
120+ LEAD, // /< window function, accesses row at specified offset following current row
121+ LAG, // /< window function, accesses row at specified offset preceding current row
122+ PTX, // /< PTX based UDF aggregation
123+ CUDA, // /< CUDA based UDF aggregation
124+ HOST_UDF, // /< host based UDF aggregation
125+ MERGE_LISTS, // /< merge multiple lists values into one list
126+ MERGE_SETS, // /< merge multiple lists values into one list then drop duplicate entries
127+ MERGE_M2, // /< merge partial values of M2 aggregation,
128+ COVARIANCE, // /< covariance between two sets of elements
129+ CORRELATION, // /< correlation between two sets of elements
130+ TDIGEST, // /< create a tdigest from a set of input values
131+ MERGE_TDIGEST, // /< create a tdigest by merging multiple tdigests together
132+ HISTOGRAM, // /< compute frequency of each element
133+ MERGE_HISTOGRAM, // /< merge partial values of HISTOGRAM aggregation
134+ BITWISE_AGG // /< bitwise aggregation on numeric columns
125135 };
126136
127137 aggregation () = delete ;
@@ -783,12 +793,21 @@ std::unique_ptr<Base> make_tdigest_aggregation(int max_centroids = 1000);
783793template <typename Base>
784794std::unique_ptr<Base> make_merge_tdigest_aggregation (int max_centroids = 1000 );
785795
796+ /* *
797+ * @brief Factory to create a BITWISE_AGG aggregation.
798+ *
799+ * @param op The bitwise operation to perform on the input column
800+ * @return A BITWISE_AGG aggregation object
801+ */
802+ template <typename Base>
803+ std::unique_ptr<Base> make_bitwise_aggregation (bitwise_op op);
804+
786805/* *
787806 * @brief Indicate if an aggregation is supported for a source datatype.
788807 *
789- * @param source Type of the column to perform the aggregation on.
790- * @param kind The kind of the aggregation.
791- * @returns true if the aggregation is supported.
808+ * @param source Type of the column to perform the aggregation on
809+ * @param kind The kind of the aggregation
810+ * @returns true if the aggregation is supported
792811 */
793812bool is_valid_aggregation (data_type source, aggregation::Kind kind);
794813
0 commit comments