clintropolis commented on code in PR #14542:
URL: https://github.com/apache/druid/pull/14542#discussion_r1262016867
##########
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/vector/HllSketchBuildVectorProcessorFactory.java:
##########
@@ -83,6 +89,48 @@ public HllSketchBuildVectorProcessor
makeLongProcessor(ColumnCapabilities capabi
return new LongHllSketchBuildVectorProcessor(helper, selector);
}
+ @Override
+ public HllSketchBuildVectorProcessor makeArrayProcessor(
+ ColumnCapabilities capabilities,
+ VectorObjectSelector selector
+ )
+ {
+ final ExpressionType expressionType =
ExpressionType.fromColumnTypeStrict(capabilities);
+ return new HllSketchBuildVectorProcessor()
+ {
+ @Override
+ public void aggregate(ByteBuffer buf, int position, int startRow, int
endRow)
+ {
+ final Object[] vector = selector.getObjectVector();
+ final HllSketch sketch = helper.getSketchAtPosition(buf, position);
+
+ for (int i = startRow; i < endRow; i++) {
+ if (vector[i] != null) {
+ byte[] bytes = ExprEval.toBytes(expressionType, vector[i]);
+ sketch.update(bytes);
+ }
+ }
+ }
+
+ @Override
+ public void aggregate(ByteBuffer buf, int numRows, int[] positions,
@Nullable int[] rows, int positionOffset)
+ {
+ final Object[] vector = selector.getObjectVector();
+
+ for (int i = 0; i < numRows; i++) {
+ final int idx = rows != null ? rows[i] : i;
+ final int position = positions[i] + positionOffset;
+ final HllSketch sketch = helper.getSketchAtPosition(buf, position);
+
+ if (vector[idx] != null) {
+ byte[] bytes = ExprEval.toBytes(expressionType, vector[idx]);
+ sketch.update(bytes);
+ }
+ }
+ }
+ };
+ }
+
Review Comment:
this was on purpose, as mentioned in the other comment `processAsArray` was
intended as a flag to influence how per-row detection of types treats `List`
rather than a feature flag to entirely disallow supporting arrays for these aggs
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]