Skip to content

Commit

Permalink
PARQUET-2498. Vector IO to handle empty range list
Browse files Browse the repository at this point in the history
Empty range lists currently trigger IllegalArgumentException,
however some (integration test) codepaths attempt to do this.

Downgrading the empty list case to a no-op resolves this.

Contributed by Steve Loughran

Change-Id: I07ed7e8f0628e170441a2d0679e822d23cfb1440
  • Loading branch information
steveloughran committed Jun 12, 2024
1 parent bc603e9 commit 9352ea5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,12 @@ private static ParquetFileRange validateRangeRequest(ParquetFileRange range) {
private static List<ParquetFileRange> validateAndSortRanges(final List<ParquetFileRange> input) {

requireNonNull(input, "Null input list");
checkArgument(!input.isEmpty(), "Empty input list");
if (input.isEmpty()) {
// this may seem a pathological case, but it
// has surfaced during testing.
LOG.debug("Empty input list");
return input;
}
final List<ParquetFileRange> sortedRanges;

if (input.size() == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ public void testNullRangeList() throws Exception {
verifyExceptionalVectoredRead(null, NullPointerException.class);
}

/**
* An empty range list is permitted.
*/
@Test
public void testEmptyRangeList() throws Exception {
List<ParquetFileRange> fileRanges = new ArrayList<>();
try (FSDataInputStream in = openTestFile()) {
readVectored(in, fileRanges);
}
}

@Test
public void testSomeRandomNonOverlappingRanges() throws Exception {
List<ParquetFileRange> fileRanges = ranges(
Expand Down

0 comments on commit 9352ea5

Please sign in to comment.