Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private Block readNullBlock(boolean[] isNull, int nonNullCount)
int minNonNullValueSize = minNonNullValueSize(nonNullCount);
if (nonNullValueTemp.length < minNonNullValueSize) {
nonNullValueTemp = new byte[minNonNullValueSize];
systemMemoryContext.setBytes(sizeOf(nonNullValueTemp));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

dataStream.getSetBits(nonNullCount, nonNullValueTemp);
Expand Down Expand Up @@ -225,6 +225,6 @@ public void close()
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE;
return INSTANCE_SIZE + sizeOf(nonNullValueTemp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private Block readNullBlock(boolean[] isNull, int nonNullCount)
int minNonNullValueSize = minNonNullValueSize(nonNullCount);
if (nonNullValueTemp.length < minNonNullValueSize) {
nonNullValueTemp = new byte[minNonNullValueSize];
systemMemoryContext.setBytes(sizeOf(nonNullValueTemp));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

dataStream.next(nonNullValueTemp, nonNullCount);
Expand Down Expand Up @@ -220,6 +220,6 @@ public void close()
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE;
return INSTANCE_SIZE + sizeOf(nonNullValueTemp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private Block longReadNullBlock(boolean[] isNull, int nonNullCount)
int minNonNullValueSize = minNonNullValueSize(nonNullCount);
if (longNonNullValueTemp.length < minNonNullValueSize) {
longNonNullValueTemp = new long[minNonNullValueSize];
systemMemoryContext.setBytes(sizeOf(longNonNullValueTemp));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

dataStream.next(longNonNullValueTemp, nonNullCount);
Expand All @@ -210,7 +210,7 @@ private Block intReadNullBlock(boolean[] isNull, int nonNullCount)
int minNonNullValueSize = minNonNullValueSize(nonNullCount);
if (intNonNullValueTemp.length < minNonNullValueSize) {
intNonNullValueTemp = new int[minNonNullValueSize];
systemMemoryContext.setBytes(sizeOf(intNonNullValueTemp));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

dataStream.next(intNonNullValueTemp, nonNullCount);
Expand All @@ -227,7 +227,7 @@ private Block shortReadNullBlock(boolean[] isNull, int nonNullCount)
int minNonNullValueSize = minNonNullValueSize(nonNullCount);
if (shortNonNullValueTemp.length < minNonNullValueSize) {
shortNonNullValueTemp = new short[minNonNullValueSize];
systemMemoryContext.setBytes(sizeOf(shortNonNullValueTemp));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

dataStream.next(shortNonNullValueTemp, nonNullCount);
Expand Down Expand Up @@ -296,6 +296,6 @@ public void close()
@Override
public long getRetainedSizeInBytes()
{
return INSTANCE_SIZE;
return INSTANCE_SIZE + sizeOf(shortNonNullValueTemp) + sizeOf(longNonNullValueTemp) + sizeOf(intNonNullValueTemp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void openRowGroup()
// resize the dictionary lengths array if necessary
if (stripeDictionaryLength.length < stripeDictionarySize) {
stripeDictionaryLength = new int[stripeDictionarySize];
systemMemoryContext.setBytes(sizeOf(stripeDictionaryLength));
systemMemoryContext.setBytes(getRetainedSizeInBytes());
}

// read the lengths
Expand All @@ -236,11 +236,11 @@ private void openRowGroup()

// we must always create a new dictionary array because the previous dictionary may still be referenced
stripeDictionaryData = new byte[toIntExact(dataLength)];
systemMemoryContext.setBytes(sizeOf(stripeDictionaryData));
systemMemoryContext.setBytes(getRetainedSizeInBytes());

// add one extra entry for null
stripeDictionaryOffsetVector = new int[stripeDictionarySize + 2];
systemMemoryContext.setBytes(sizeOf(stripeDictionaryOffsetVector));
systemMemoryContext.setBytes(getRetainedSizeInBytes());

// read dictionary values
ByteArrayInputStream dictionaryDataStream = stripeDictionaryDataStreamSource.openStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public void testBigIntTypeWithNulls()

// StripeReader memory should increase after reading a block.
assertGreaterThan(reader.getCurrentStripeRetainedSizeInBytes(), stripeReaderRetainedSize);
// There are no local buffers needed.
assertEquals(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 0L);
// There are local buffers needed.
assertGreaterThan(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 0L);
// The total retained size and system memory usage should be strictly larger than 0L because of the instance sizes.
assertGreaterThan(reader.getRetainedSizeInBytes() - readerRetainedSize, 0L);
assertGreaterThan(reader.getSystemMemoryUsage() - readerSystemMemoryUsage, 0L);
Expand Down Expand Up @@ -189,8 +189,8 @@ public void testMapTypeWithNulls()

// StripeReader memory should increase after reading a block.
assertGreaterThan(reader.getCurrentStripeRetainedSizeInBytes(), stripeReaderRetainedSize);
// There are no local buffers needed.
assertEquals(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 0L);
// There are local buffers needed.
assertGreaterThan(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 0L);
// The total retained size and system memory usage should be strictly larger than 0L because of the instance sizes.
assertGreaterThan(reader.getRetainedSizeInBytes() - readerRetainedSize, 0L);
assertGreaterThan(reader.getSystemMemoryUsage() - readerSystemMemoryUsage, 0L);
Expand Down