Skip to content

Commit

Permalink
Use consistent null handling in retained size per part
Browse files Browse the repository at this point in the history
  • Loading branch information
pettyjamesm authored and sopel39 committed Mar 14, 2022
1 parent 2594f82 commit 7b3bed7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
{
consumer.accept(values, values.getRetainedSizeInBytes());
consumer.accept(offsets, sizeOf(offsets));
consumer.accept(valueIsNull, sizeOf(valueIsNull));
if (valueIsNull != null) {
consumer.accept(valueIsNull, sizeOf(valueIsNull));
}
consumer.accept(this, (long) INSTANCE_SIZE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
consumer.accept(keyBlock, keyBlock.getRetainedSizeInBytes());
consumer.accept(valueBlock, valueBlock.getRetainedSizeInBytes());
consumer.accept(offsets, sizeOf(offsets));
consumer.accept(mapIsNull, sizeOf(mapIsNull));
if (mapIsNull != null) {
consumer.accept(mapIsNull, sizeOf(mapIsNull));
}
consumer.accept(hashTables, hashTables.getRetainedSizeInBytes());
consumer.accept(this, (long) INSTANCE_SIZE);
}
Expand Down
8 changes: 6 additions & 2 deletions core/trino-spi/src/main/java/io/trino/spi/block/RowBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,12 @@ public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
for (int i = 0; i < numFields; i++) {
consumer.accept(fieldBlocks[i], fieldBlocks[i].getRetainedSizeInBytes());
}
consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets));
consumer.accept(rowIsNull, sizeOf(rowIsNull));
if (fieldBlockOffsets != null) {
consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets));
}
if (rowIsNull != null) {
consumer.accept(rowIsNull, sizeOf(rowIsNull));
}
consumer.accept(this, (long) INSTANCE_SIZE);
}

Expand Down

0 comments on commit 7b3bed7

Please sign in to comment.