Skip to content

Commit

Permalink
Add docs and reduction aggregations
Browse files Browse the repository at this point in the history
  • Loading branch information
ttnghia committed Sep 21, 2023
1 parent e701908 commit 31093cd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions java/src/main/java/ai/rapids/cudf/GroupByAggregation.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,24 @@ public static GroupByAggregation mergeTDigest(int delta) {
return new GroupByAggregation(Aggregation.mergeTDigest(delta));
}

/**
* Histogram aggregation, computing the frequencies for each unique row.
*
* A histogram is given as a lists column, in which the first child stores unique rows from
* the input values and the second child stores their corresponding frequencies.
*
* @return A lists of structs column in which each list contains a histogram corresponding to
* an input key.
*/
public static GroupByAggregation histogram() {
return new GroupByAggregation(Aggregation.histogram());
}

/**
* MergeHistogram aggregation, to merge multiple histograms.
*
* @return A new histogram in which the frequencies of the unique rows are sum up.
*/
public static GroupByAggregation mergeHistogram() {
return new GroupByAggregation(Aggregation.mergeHistogram());
}
Expand Down
18 changes: 18 additions & 0 deletions java/src/main/java/ai/rapids/cudf/ReductionAggregation.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,22 @@ public static ReductionAggregation mergeSets(NullEquality nullEquality, NaNEqual
return new ReductionAggregation(Aggregation.mergeSets(nullEquality, nanEquality));
}

/**
* Create HistogramAggregation, computing the frequencies for each unique row.
*
* @return A structs column in which the first child stores unique rows from the input and the
* second child stores their corresponding frequencies.
*/
public static ReductionAggregation histogram() {
return new ReductionAggregation(Aggregation.histogram());
}

/**
* Create MergeHistogramAggregation, to merge multiple histograms.
*
* @return A new histogram in which the frequencies of the unique rows are sum up.
*/
public static ReductionAggregation mergeHistogram() {
return new ReductionAggregation(Aggregation.mergeHistogram());
}
}

0 comments on commit 31093cd

Please sign in to comment.