michaelsembwever commented on code in PR #4506:
URL: https://github.com/apache/cassandra/pull/4506#discussion_r2616380144
##########
src/java/org/apache/cassandra/cql3/BatchQueryOptions.java:
##########
@@ -91,6 +93,50 @@ public long getNowInSeconds(QueryState state)
return wrapped.getNowInSeconds(state);
}
+ private static class BatchQueryOptionsWrapper extends
QueryOptions.QueryOptionsWrapper {
+ private final byte[][] valuesAsByteArray;
+ private List<ByteBuffer> values; // initialized on demand
+
+ BatchQueryOptionsWrapper(QueryOptions wrapped, byte[][] vars)
+ {
+ super(wrapped);
+ this.valuesAsByteArray = vars;
+ }
+ public List<ByteBuffer> getValues()
+ {
+ if (values == null)
+ {
+ values = new ArrayList<>(valuesAsByteArray.length);
+ for (byte[] byteArrayValue : valuesAsByteArray)
+ values.add(convertToByteBufferValue(byteArrayValue));
+ }
+ return values;
+ }
+
+ public int getValuesSize()
+ {
+ return valuesAsByteArray.length;
+ }
+
+ public ByteBuffer getValue(int index)
+ {
+ if (values == null) // we convert values to ByteBuffer in a lazy
way, on demand
+ return convertToByteBufferValue(valuesAsByteArray[index]);
Review Comment:
this risks repetition, can that be a problem ?
alternative would be to fill values with null beforehand and store
lazy-instantiated elements
--
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]