dario-liberman commented on code in PR #11092: URL: https://github.com/apache/pinot/pull/11092#discussion_r1272661647
########## pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/FunnelCountAggregationFunction.java: ########## @@ -35,46 +50,107 @@ import org.apache.pinot.core.query.aggregation.groupby.ObjectGroupByResultHolder; import org.apache.pinot.segment.spi.AggregationFunctionType; import org.apache.pinot.segment.spi.index.reader.Dictionary; +import org.apache.pinot.spi.data.FieldSpec; +import org.roaringbitmap.PeekableIntIterator; import org.roaringbitmap.RoaringBitmap; /** - * The {@code FunnelCountAggregationFunction} calculates the number of step conversions for a given partition column and - * a list of boolean expressions. - * <p>IMPORTANT: This function relies on the partition column being partitioned for each segment, where there are no - * common values across different segments. - * <p>This function calculates the exact number of step matches per partition key within the segment, then sums up the - * results from different segments. + * The {@code FunnelCountAggregationFunction} calculates the number of conversions for a given correlation column and + * a list of steps as boolean expressions. * * Example: * SELECT * dateTrunc('day', timestamp) AS ts, * FUNNEL_COUNT( * STEPS(url = '/addToCart', url = '/checkout', url = '/orderConfirmation'), - * CORRELATED_BY(user) + * CORRELATED_BY(user_id) * ) as step_counts * FROM user_log * WHERE url in ('/addToCart', '/checkout', '/orderConfirmation') * GROUP BY 1 + * + * Counting strategies can be controlled via optional SETTINGS options, for example: + * + * FUNNEL_COUNT( + * STEPS(url = '/addToCart', url = '/checkout', url = '/orderConfirmation'), + * CORRELATED_BY(user_id), + * SETTINGS('theta_sketch','nominalEntries=4096') + * ) + * + * There are 5 strategies available, mirroring the corresponding distinct count implementations as per below. + * <p><ul> + * <li>'set': See DISTINCTCOUNT at {@link DistinctCountAggregationFunction} + * <li>'bitmap' (default): See DISTINCTCOUNTBITMAP at {@link DistinctCountBitmapAggregationFunction} + * <li>'theta_sketch': See DISTINCTCOUNTTHETASKETCH at {@link DistinctCountThetaSketchAggregationFunction} + * <li>'partitioned': See SEGMENTPARTITIONEDDISTINCTCOUNT {@link SegmentPartitionedDistinctCountAggregationFunction} + * <li>'sorted': sorted counts per segment then sums up. Only availabe in combination with 'partitioned'. + * <li>'nominalEntries=4096': theta sketch configuration, default is 4096. + * </ul><p> */ -public class FunnelCountAggregationFunction implements AggregationFunction<List<Long>, LongArrayList> { +public class FunnelCountAggregationFunction implements AggregationFunction<Object, LongArrayList> { Review Comment: Yes, unfortunately java has no support for union types (well, only in exception catch clauses). I can create a wrapper if you think that helps, as each strategy is effectively using a different underlying aggregation type. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org