xiangfu0 commented on code in PR #18873:
URL: https://github.com/apache/pinot/pull/18873#discussion_r3798260865
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionUtils.java:
##########
@@ -799,10 +800,12 @@ private static HyperLogLogPlus
getDistinctValueHLLPlus(Dictionary dictionary, in
return hllPlus;
}
- private static HyperLogLog getDistinctCountHLLResult(Dictionary dictionary,
+ private static HyperLogLog getDistinctCountHLLResult(DataSource dataSource,
DistinctCountHLLAggregationFunction function, String explainPlanName) {
- if (dictionary.getValueType() == FieldSpec.DataType.BYTES) {
- // Treat BYTES value as serialized HyperLogLog
+ Dictionary dictionary = Objects.requireNonNull(dataSource.getDictionary());
Review Comment:
Updated all three dictionary helpers to retrieve the dictionary once and
assert the non-null invariant.
##########
pinot-core/src/main/java/org/apache/pinot/core/query/distinct/table/BytesDistinctTable.java:
##########
@@ -290,9 +291,10 @@ private ResultTable toResultTableWithOrderBy() {
return new ResultTable(_dataSchema, rows);
}
- private static void addRows(ByteArray[] values, int length, List<Object[]>
rows) {
+ private void addRows(ByteArray[] values, int length, List<Object[]> rows) {
+ ColumnDataType columnDataType = _dataSchema.getColumnDataType(0);
Review Comment:
Updated both BytesDistinctTable output paths to branch once on UUID versus
BYTES outside the value loop and use direct formatting.
##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/GroupByDataTableReducer.java:
##########
@@ -531,6 +531,8 @@ private Object getConvertedKey(DataTable dataTable,
ColumnDataType columnDataTyp
return dataTable.getString(rowId, colId);
case BYTES:
return dataTable.getBytes(rowId, colId).getBytes();
+ case UUID:
+ return columnDataType.convert(dataTable.getBytes(rowId, colId));
Review Comment:
Updated the UUID group-key conversion to call UuidUtils.toUUID() directly.
--
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]