blerer commented on code in PR #3348:
URL: https://github.com/apache/cassandra/pull/3348#discussion_r1627703349
##########
src/java/org/apache/cassandra/cql3/restrictions/SimpleRestriction.java:
##########
@@ -229,18 +231,40 @@ 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())
Review Comment:
The code will be easier to read if we handle the empty case right from the
start:
```
if (values.isEmpty())
return Collections.emptyList();
```
--
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]