Skip to content

Commit

Permalink
Avoid calling SelectiveStreamReader#read with zero positions to read
Browse files Browse the repository at this point in the history
  • Loading branch information
mbasmanova committed Aug 23, 2019
1 parent 6d22ca9 commit 0a41532
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private void openRowGroup()
public int read(int offset, int[] positions, int positionCount)
throws IOException
{
checkArgument(positionCount > 0, "positionCount must be greater than zero");
checkState(!valuesInUse, "BlockLease hasn't been closed yet");

if (!rowGroupOpen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private static Optional<TupleDomainFilter> getTopLevelFilter(Map<Subfield, Tuple
public int read(int offset, int[] positions, int positionCount)
throws IOException
{
checkArgument(positionCount > 0, "positionCount must be greater than zero");
checkState(!valuesInUse, "BlockLease hasn't been closed yet");

if (!rowGroupOpen) {
Expand Down Expand Up @@ -369,7 +370,7 @@ private int readNotAllNulls(int[] positions, int positionCount)
listFilter.populateElementFilters(outputPositionCount, nulls, elementLengths, elementPositionCount);
}

if (elementStreamReader != null) {
if (elementStreamReader != null && elementPositionCount > 0) {
elementStreamReader.read(elementReadOffset, elementPositions, elementPositionCount);
}
elementReadOffset += elementPositionCount + skippedElements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public LongDictionarySelectiveStreamReader(
public int read(int offset, int[] positions, int positionCount)
throws IOException
{
checkArgument(positionCount > 0, "positionCount must be greater than zero");

if (!rowGroupOpen) {
openRowGroup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public LongDirectSelectiveStreamReader(
public int read(int offset, int[] positions, int positionCount)
throws IOException
{
checkArgument(positionCount > 0, "positionCount must be greater than zero");

if (!rowGroupOpen) {
openRowGroup();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ private void openRowGroup()
public int read(int offset, int[] positions, int positionCount)
throws IOException
{
checkArgument(positionCount > 0, "positionCount must be greater than zero");
checkState(!valuesInUse, "BlockLease hasn't been closed yet");

if (!rowGroupOpen) {
Expand Down

0 comments on commit 0a41532

Please sign in to comment.