diff --git a/presto-orc/src/main/java/io/prestosql/orc/AbstractOrcRecordReader.java b/presto-orc/src/main/java/io/prestosql/orc/AbstractOrcRecordReader.java index 50b674ce7..fdbe37b10 100644 --- a/presto-orc/src/main/java/io/prestosql/orc/AbstractOrcRecordReader.java +++ b/presto-orc/src/main/java/io/prestosql/orc/AbstractOrcRecordReader.java @@ -325,7 +325,7 @@ abstract class AbstractOrcRecordReader if (!andDomainMap.isEmpty()) { Iterator thisStripeMatchingRows = ((andDomainMap.entrySet().iterator().next()).getKey()).getMatches(andDomainMap); - if (thisStripeMatchingRows.hasNext()) { + if (thisStripeMatchingRows != null && thisStripeMatchingRows.hasNext()) { PeekingIterator peekingIterator = Iterators.peekingIterator(thisStripeMatchingRows); if (peekingIterator.peek() != null) { this.stripeMatchingRows.put(stripe, peekingIterator); @@ -337,7 +337,7 @@ abstract class AbstractOrcRecordReader if (!orDomainMap.isEmpty()) { for (Map.Entry indexDomainEntry : orDomainMap.entrySet()) { Iterator thisStripeMatchingRows = (indexDomainEntry.getKey()).getMatches(indexDomainEntry.getValue()); - if (thisStripeMatchingRows.hasNext()) { + if (thisStripeMatchingRows != null && thisStripeMatchingRows.hasNext()) { /* any one matched; then include the stripe */ return false; } diff --git a/presto-orc/src/main/java/io/prestosql/orc/reader/AbstractLongSelectiveColumnReader.java b/presto-orc/src/main/java/io/prestosql/orc/reader/AbstractLongSelectiveColumnReader.java index eee16cc7c..c84dd89bc 100644 --- a/presto-orc/src/main/java/io/prestosql/orc/reader/AbstractLongSelectiveColumnReader.java +++ b/presto-orc/src/main/java/io/prestosql/orc/reader/AbstractLongSelectiveColumnReader.java @@ -163,7 +163,7 @@ abstract class AbstractLongSelectiveColumnReader } valuesCopy[positionIndex] = this.values[i]; - if (includeNulls) { + if (nullsCopy != null) { nullsCopy[positionIndex] = this.nulls[i]; } @@ -204,7 +204,7 @@ abstract class AbstractLongSelectiveColumnReader } valuesCopy[positionIndex] = toIntExact(this.values[i]); - if (includeNulls) { + if (nullsCopy != null) { nullsCopy[positionIndex] = this.nulls[i]; } @@ -235,7 +235,7 @@ abstract class AbstractLongSelectiveColumnReader } valuesCopy[positionIndex] = (short) this.values[i]; - if (includeNulls) { + if (nullsCopy != null) { nullsCopy[positionIndex] = this.nulls[i]; }