Skip to content

Commit 18100f6

Browse files
committed
PARQUET-2498. Vector IO to handle empty range list
- Downgrade to a no-op - Add test Contributed by Steve Loughran Change-Id: I07ed7e8f0628e170441a2d0679e822d23cfb1440
1 parent bc603e9 commit 18100f6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/wrapped/io/VectorIoBridge.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,12 @@ private static ParquetFileRange validateRangeRequest(ParquetFileRange range) {
362362
private static List<ParquetFileRange> validateAndSortRanges(final List<ParquetFileRange> input) {
363363

364364
requireNonNull(input, "Null input list");
365-
checkArgument(!input.isEmpty(), "Empty input list");
365+
if (input.isEmpty()) {
366+
// this may seem a pathological case, but it
367+
// has surfaced during testing.
368+
LOG.debug("Empty input list");
369+
return input;
370+
}
366371
final List<ParquetFileRange> sortedRanges;
367372

368373
if (input.size() == 1) {

parquet-hadoop/src/test/java/org/apache/parquet/hadoop/util/wrapped/io/TestVectorIoBridge.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,17 @@ public void testNullRangeList() throws Exception {
305305
verifyExceptionalVectoredRead(null, NullPointerException.class);
306306
}
307307

308+
/**
309+
* An empty range list is permitted.
310+
*/
311+
@Test
312+
public void testEmptyRangeList() throws Exception {
313+
List<ParquetFileRange> fileRanges = new ArrayList<>();
314+
try (FSDataInputStream in = openTestFile()) {
315+
readVectored(in, fileRanges);
316+
}
317+
}
318+
308319
@Test
309320
public void testSomeRandomNonOverlappingRanges() throws Exception {
310321
List<ParquetFileRange> fileRanges = ranges(

0 commit comments

Comments
 (0)