netudima commented on code in PR #4795:
URL: https://github.com/apache/cassandra/pull/4795#discussion_r3246777502
##########
src/java/org/apache/cassandra/db/rows/Row.java:
##########
@@ -778,22 +784,51 @@ public Row merge(DeletionTime activeDeletion)
if (activeDeletion.deletes(rowInfo))
rowInfo = LivenessInfo.EMPTY;
+ int columnsCountEstimation = 0;
for (Row row : rows)
- columnDataIterators.add(row == null ?
Collections.emptyIterator() : row.iterator());
+ {
+ if (row != null)
+ {
+ columnDataIterators.add(row.iterator());
+ columnsCountEstimation = Math.max(columnsCountEstimation,
row.columnCount());
+ }
+ else
+ {
+ columnDataIterators.add(Collections.emptyIterator());
+ }
+ }
+ // try to estimate and set a potential target capacity
+ if (dataBuffer.length < columnsCountEstimation)
+ dataBuffer = Arrays.copyOf(dataBuffer, columnsCountEstimation);
Review Comment:
agree, the expected pattern to use Merger is add() x N, then merge() x 1 and
clear() x 1
no reason to try to preserve a state in the dataBuffer
--
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]