smiklosovic commented on code in PR #3348:
URL: https://github.com/apache/cassandra/pull/3348#discussion_r1627326048
##########
src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java:
##########
@@ -229,18 +231,42 @@ private List<ClusteringElements>
bindAndGetClusteringElements(QueryOptions optio
{
case SINGLE_COLUMN:
case TOKEN:
- return bindAndGet(options).stream()
- .map(b ->
ClusteringElements.of(columnsExpression.columnSpecification(), b))
- .collect(Collectors.toList());
+ return bindAndGetSingleTermClusteringElements(options);
case MULTI_COLUMN:
- return bindAndGetElements(options).stream()
- .map(buffers ->
ClusteringElements.of(columnsExpression.columns(), buffers))
-
.collect(Collectors.toList());
+ return bindAndGetMultiTermClusteringElements(options);
default:
throw new UnsupportedOperationException();
}
}
+ private List<ClusteringElements>
bindAndGetSingleTermClusteringElements(QueryOptions options)
+ {
+ List<ByteBuffer> values = bindAndGet(options);
+ if (!values.isEmpty()) {
+ List<ClusteringElements> elements = new ArrayList<>();
+ for (ByteBuffer value : values) {
+ ClusteringElements byteBuffers =
ClusteringElements.of(columnsExpression.columnSpecification(), value);
+ elements.add(byteBuffers);
+ }
+ return elements;
Review Comment:
@samueldlightfoot just wrap `elements` in
`Collections.unmodifiableList(elements)` if you need it to be unmodifiable
--
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]