Skip to content

Commit

Permalink
Make #getDomain return nonnull value
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Feb 5, 2019
1 parent 972fdec commit 1f4caa8
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -118,10 +118,8 @@ public boolean matches(Map<ColumnDescriptor, DictionaryDescriptor> dictionaries)
}
DictionaryDescriptor dictionaryDescriptor = dictionaries.get(column);
Domain domain = getDomain(effectivePredicateDomain.getType(), dictionaryDescriptor);
if (domain != null) {
if (effectivePredicateDomain.intersect(domain).isNone()) {
return false;
}
if (effectivePredicateDomain.intersect(domain).isNone()) {
return false;
}
}
return true;
Expand Down Expand Up @@ -232,13 +230,13 @@ else if (type.equals(DATE) && statistics instanceof IntStatistics) {
public static Domain getDomain(Type type, DictionaryDescriptor dictionaryDescriptor)
{
if (dictionaryDescriptor == null) {
return null;
return Domain.all(type);
}

ColumnDescriptor columnDescriptor = dictionaryDescriptor.getColumnDescriptor();
Optional<DictionaryPage> dictionaryPage = dictionaryDescriptor.getDictionaryPage();
if (!dictionaryPage.isPresent()) {
return null;
return Domain.all(type);
}

Dictionary dictionary;
Expand All @@ -248,7 +246,8 @@ public static Domain getDomain(Type type, DictionaryDescriptor dictionaryDescrip
catch (Exception e) {
// In case of exception, just continue reading the data, not using dictionary page at all
// OK to ignore exception when reading dictionaries
return null;
// TODO take failOnCorruptedParquetStatistics parameter and handle appropriately
return Domain.all(type);
}

int dictionarySize = dictionaryPage.get().getDictionarySize();
Expand Down Expand Up @@ -292,7 +291,7 @@ else if (isVarcharType(type) && columnDescriptor.getType() == PrimitiveTypeName.
domains.add(Domain.onlyNull(type));
return Domain.union(domains);
}
return null;
return Domain.all(type);
}

private static void failWithCorruptionException(boolean failOnCorruptedParquetStatistics, String column, ParquetDataSourceId id, Statistics statistics)
Expand Down

0 comments on commit 1f4caa8

Please sign in to comment.