frankgh commented on code in PR #4795:
URL: https://github.com/apache/cassandra/pull/4795#discussion_r3230495854
##########
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:
Any reason why we don't directly do ?
```suggestion
dataBuffer = new ColumnData[columnsCountEstimation];
```
--
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]