Skip to content

Commit

Permalink
Change RowBlock getSizeInBytes to not include nulls array when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
dain committed Oct 14, 2024
1 parent 9a18afd commit 7ed50e2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 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 @@ -198,10 +198,7 @@ public long getSizeInBytes()
return sizeInBytes;
}

sizeInBytes = 0;
if (rowIsNull != null) {
sizeInBytes += Byte.BYTES * (long) positionCount;
}
sizeInBytes = rowIsNull == null ? 0 : Byte.BYTES * (long) positionCount;

boolean hasUnloadedBlocks = false;
for (Block fieldBlock : fieldBlocks) {
Expand Down Expand Up @@ -393,7 +390,7 @@ public long getRegionSizeInBytes(int position, int length)
{
checkValidRegion(positionCount, position, length);

long regionSizeInBytes = Byte.BYTES * (long) length;
long regionSizeInBytes = rowIsNull == null ? 0 : Byte.BYTES * (long) length;
for (Block fieldBlock : fieldBlocks) {
regionSizeInBytes += fieldBlock.getRegionSizeInBytes(position, length);
}
Expand All @@ -415,7 +412,7 @@ public long getPositionsSizeInBytes(boolean[] positions, int selectedRowPosition
return fixedSizePerRow * (long) selectedRowPositions;
}

long sizeInBytes = Byte.BYTES * (long) selectedRowPositions;
long sizeInBytes = rowIsNull == null ? 0 : Byte.BYTES * (long) selectedRowPositions;
for (Block fieldBlock : fieldBlocks) {
sizeInBytes += fieldBlock.getPositionsSizeInBytes(positions, selectedRowPositions);
}
Expand Down

0 comments on commit 7ed50e2

Please sign in to comment.