dcapwell commented on code in PR #4561:
URL: https://github.com/apache/cassandra/pull/4561#discussion_r2748408935
##########
src/java/org/apache/cassandra/index/sai/utils/IndexTermType.java:
##########
@@ -453,6 +459,70 @@ public Iterator<ByteBuffer> valuesOf(Row row, long
nowInSecs)
}
}
+ public Iterator<ByteBuffer> valuesOfFrozenCollection (Row row, long
nowInSecs)
+ {
+ Cell<?> cell = row.getCell(columnMetadata);
+ if (cell == null || !cell.isLive(nowInSecs))
+ return null;
+
+ ByteBuffer buffer = cell.buffer();
+ if (buffer == null || buffer.remaining() == 0)
+ return null;
+
+ CollectionType<?> collectionType = (CollectionType<?>)
columnMetadata.type.unwrap();
+ CollectionSerializer<?> serializer = collectionType.getSerializer();
+ List<ByteBuffer> elements = serializer.unpack(buffer);
+
+ Stream<ByteBuffer> stream;
+ switch (collectionType.kind)
+ {
+ case LIST:
+ case SET:
+ stream = elements.stream();
+ break;
+ case MAP:
+ stream = extractMapElements(elements);
+ break;
+ default:
+ throw new IllegalArgumentException("Unsupported type of
collection - " + collectionType.kind);
+ }
+
+ if (isInetAddress())
+ stream = stream.sorted((c1, c2) ->
compareInet(encodeInetAddress(c1), encodeInetAddress(c2)));
+
+ List<ByteBuffer> resultList =
stream.collect(java.util.stream.Collectors.toList());
Review Comment:
```suggestion
List<ByteBuffer> resultList = stream.collect(Collectors.toList());
```
Is there a reason not to import collectors?
--
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]