Skip to content

Commit

Permalink
Avoid passing nulls into retained size consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
pettyjamesm committed Mar 18, 2022
1 parent c834917 commit 1bd87f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ArrayBlock

private final int arrayOffset;
private final int positionCount;
@Nullable
private final boolean[] valueIsNull;
private final Block values;
private final int[] offsets;
Expand Down Expand Up @@ -159,7 +160,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 @@ -35,6 +35,7 @@ public class MapBlock
private final int startOffset;
private final int positionCount;

@Nullable
private final boolean[] mapIsNull;
private final int[] offsets;
private final Block keyBlock;
Expand Down Expand Up @@ -253,7 +254,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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class RowBlock
private final int startOffset;
private final int positionCount;

@Nullable
private final boolean[] rowIsNull;
private final int[] fieldBlockOffsets;
private final Block[] fieldBlocks;
Expand Down Expand Up @@ -240,7 +241,9 @@ public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer)
consumer.accept(fieldBlocks[i], fieldBlocks[i].getRetainedSizeInBytes());
}
consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets));
consumer.accept(rowIsNull, sizeOf(rowIsNull));
if (rowIsNull != null) {
consumer.accept(rowIsNull, sizeOf(rowIsNull));
}
consumer.accept(this, (long) INSTANCE_SIZE);
}

Expand Down

0 comments on commit 1bd87f8

Please sign in to comment.