@SuppressWarnings("unchecked") private <T> T min(Statistics<?> stats, int id) { return (T) conversions.get(id).apply(stats.genericGetMin()); }
/** * Returns the string representation of min for debugging/logging purposes. * * @return the min value as a string */ public String minAsString() { return stringify(genericGetMin()); }
/** * Returns the string representation of min for debugging/logging purposes. * * @return the min value as a string */ public String minAsString() { return stringify(genericGetMin()); }
/** * Compares min to the specified value in the proper way. It does the same as invoking * {@code comparator().compare(genericGetMin(), value)}. The corresponding statistics implementations overload this * method so the one with the primitive argument shall be used to avoid boxing/unboxing. * * @param value * the value which {@code min} is to be compared to * @return a negative integer, zero, or a positive integer as {@code min} is less than, equal to, or greater than * {@code value}. */ public final int compareMinToValue(T value) { return comparator.compare(genericGetMin(), value); }
/** * Compares min to the specified value in the proper way. It does the same as invoking * {@code comparator().compare(genericGetMin(), value)}. The corresponding statistics implementations overload this * method so the one with the primitive argument shall be used to avoid boxing/unboxing. * * @param value * the value which {@code min} is to be compared to * @return a negative integer, zero, or a positive integer as {@code min} is less than, equal to, or greater than * {@code value}. */ public final int compareMinToValue(T value) { return comparator.compare(genericGetMin(), value); }
/** * LE (<=) predicate. */ private static <C extends Comparable<C>> LogicalExpression createLEPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { if (rightStat.compareMaxToValue(leftStat.genericGetMin()) < 0) { return RowsMatch.NONE; } return leftStat.compareMaxToValue(rightStat.genericGetMin()) <= 0 ? checkNull(leftStat, rightStat) : RowsMatch.SOME; }); }
/** * LT (<) predicate. */ private static <C extends Comparable<C>> LogicalExpression createLTPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { if (rightStat.compareMaxToValue(leftStat.genericGetMin()) <= 0) { return RowsMatch.NONE; } return leftStat.compareMaxToValue(rightStat.genericGetMin()) < 0 ? checkNull(leftStat, rightStat) : RowsMatch.SOME; }); }
/** * NE (!=) predicate. */ private static <C extends Comparable<C>> LogicalExpression createNEPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { if (leftStat.compareMaxToValue(rightStat.genericGetMin()) < 0 || rightStat.compareMaxToValue(leftStat.genericGetMin()) < 0) { return checkNull(leftStat, rightStat); } return leftStat.compareMaxToValue(rightStat.genericGetMax()) == 0 && leftStat.compareMinToValue(rightStat.genericGetMin()) == 0 ? RowsMatch.NONE : RowsMatch.SOME; }); }
/** * EQ (=) predicate */ private static <C extends Comparable<C>> LogicalExpression createEqualPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { // compare left max and right min int leftToRightComparison = leftStat.compareMaxToValue(rightStat.genericGetMin()); // compare right max and left min int rightToLeftComparison = rightStat.compareMaxToValue(leftStat.genericGetMin()); // if both comparison results are equal to 0 and both statistics have no nulls, // it means that min and max values in each statistics are the same and match each other, // return that all rows match the condition if (leftToRightComparison == 0 && rightToLeftComparison == 0 && hasNoNulls(leftStat) && hasNoNulls(rightStat)) { return RowsMatch.ALL; } // if at least one comparison result is negative, it means that none of the rows match the condition return leftToRightComparison < 0 || rightToLeftComparison < 0 ? RowsMatch.NONE : RowsMatch.SOME; }) { @Override public String toString() { return left + " = " + right; } }; }
/** * GT (>) predicate. */ private static <C extends Comparable<C>> LogicalExpression createGTPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { if (leftStat.compareMaxToValue(rightStat.genericGetMin()) <= 0) { return RowsMatch.NONE; } return leftStat.compareMinToValue(rightStat.genericGetMax()) > 0 ? checkNull(leftStat, rightStat) : RowsMatch.SOME; }); }
/** * GE (>=) predicate. */ private static <C extends Comparable<C>> LogicalExpression createGEPredicate( LogicalExpression left, LogicalExpression right ) { return new ParquetComparisonPredicate<C>(left, right, (leftStat, rightStat) -> { if (leftStat.compareMaxToValue(rightStat.genericGetMin()) < 0) { return RowsMatch.NONE; } return leftStat.compareMinToValue(rightStat.genericGetMax()) >= 0 ? checkNull(leftStat, rightStat) : RowsMatch.SOME; }); }
if (stats.genericGetMax() != null && stats.genericGetMin() != null && stats.genericGetMax().equals(stats.genericGetMin())) { mxValue = stats.genericGetMax(); if (containsCorruptDates == ParquetReaderUtility.DateCorruptionStatus.META_SHOWS_CORRUPTION
if (statsAvailable) { if (stats.hasNonNullValue()) { minValue = stats.genericGetMin(); maxValue = stats.genericGetMax(); if (containsCorruptDates == ParquetReaderUtility.DateCorruptionStatus.META_SHOWS_CORRUPTION && columnTypeMetadata.originalType == OriginalType.DATE) {
if (field != null && stats.hasNonNullValue()) { updateMin(lowerBounds, fieldId, fromParquetPrimitive(field.type(), stats.genericGetMin())); updateMax(upperBounds, fieldId, fromParquetPrimitive(field.type(), stats.genericGetMax()));
/** * Adds the data from the specified statistics to this builder * * @param stats * the statistics to be added */ public void add(Statistics<?> stats) { if (stats.hasNonNullValue()) { nullPages.add(false); Object min = stats.genericGetMin(); Object max = stats.genericGetMax(); addMinMax(min, max); pageIndexes.add(nextPageIndex); minMaxSize += sizeOf(min); minMaxSize += sizeOf(max); } else { nullPages.add(true); } nullCounts.add(stats.getNumNulls()); ++nextPageIndex; }
new org.apache.parquet.filter2.predicate.Statistics<T>(stats.genericGetMin(), stats.genericGetMax(), stats.comparator());
new org.apache.parquet.filter2.predicate.Statistics<T>(stats.genericGetMin(), stats.genericGetMax(), stats.comparator());
if (statistics.genericGetMin() == null || statistics.genericGetMax() == null) { return Domain.create(ValueSet.all(type), hasNullValue);
if (statistics.genericGetMin() == null || statistics.genericGetMax() == null) { return Domain.create(ValueSet.all(type), hasNullValue);