You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "tolbertam (via GitHub)" <gi...@apache.org> on 2024/08/27 02:06:00 UTC
Re: [PR] Don't return empty routing key when partition key is unbound [cassandra-java-driver]
tolbertam commented on code in PR #1620:
URL: https://github.com/apache/cassandra-java-driver/pull/1620#discussion_r1732022403
##########
core/src/main/java/com/datastax/oss/driver/internal/core/cql/DefaultBoundStatement.java:
##########
@@ -358,7 +358,7 @@ public ByteBuffer getRoutingKey() {
if (indices.isEmpty()) {
return null;
} else if (indices.size() == 1) {
- return getBytesUnsafe(indices.get(0));
+ return isSet(0) ? getBytesUnsafe(indices.get(0)) : null;
Review Comment:
this exactly ^. On initial look, I came to the same conclusion and felt that you could even just delete this branch and fall into the else and the behavior matches this change exactly, but I think this branch sort of exists as an optimization (avoids creating an array).
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org