clintropolis commented on code in PR #15434:
URL: https://github.com/apache/druid/pull/15434#discussion_r1407200862
##########
processing/src/main/java/org/apache/druid/query/aggregation/any/StringAnyVectorAggregator.java:
##########
@@ -78,7 +84,22 @@ public void aggregate(ByteBuffer buf, int position, int
startRow, int endRow)
if (startRow < rows.length) {
IndexedInts row = rows[startRow];
@Nullable
- String foundValue = row.size() == 0 ? null :
multiValueSelector.lookupName(row.get(0));
+ String foundValue;
+ if (row.size() == 0) {
+ foundValue = null;
+ } else if (aggregateMultipleValues) {
+ if (row.size() > 1) {
+ List<String> arrayList = new ArrayList<>();
+ row.forEach(rowIndex -> {
+ arrayList.add(multiValueSelector.lookupName(rowIndex));
+ });
+ foundValue =
DimensionHandlerUtils.convertObjectToString(arrayList);
+ } else {
+ foundValue = multiValueSelector.lookupName(row.get(0));
Review Comment:
this doesn't seem to exactly match the behavior of the `StringAnyAggregator`
and `StringAnyBufferAggregator`, which only have special case handling for 0
length lists. I think this is probably 'better' behavior for mvds since it
matches the behavior of scan queries which only show mvds as an array if the
length is bigger than 1, should we modify the other two implementations to be
consistent for handling the case where the mvd row only has a single value?
--
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]