Source:
<code>public void validateRowGroupStatistics( OrcDataSourceId orcDataSourceId, long stripeOffset, int rowGroupIndex, List<ColumnStatistics> actual) throws OrcCorruptionException { List<RowGroupStatistics> rowGroups = rowGroupStatistics.get(stripeOffset); if (rowGroups == null) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected stripe at offset %s", stripeOffset); } if (rowGroups.size() <= rowGroupIndex) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } RowGroupStatistics expectedRowGroup = rowGroups.get(rowGroupIndex); RowGroupStatistics actualRowGroup = new RowGroupStatistics(false, IntStream.range(1, actual.size()).boxed().collect(toImmutableMap(identity(), actual::get))); if (!expectedRowGroup.isLowMemoryMode()) { Map<Integer, ColumnStatistics> expectedByColumnIndex = expectedRowGroup.getColumnStatistics(); List<ColumnStatistics> expected = IntStream.range(1, actual.size()) .mapToObj(expectedByColumnIndex::get) .collect(toImmutableList()); actual = actual.subList(1, actual.size()); validateColumnStatisticsEquivalent(orcDataSourceId, "Row group " + rowGroupIndex + " in stripe at offset " + stripeOffset, actual, expected); } <START> if (expectedRowGroup.getHash() != actualRowGroup.getHash()) { <END> throw new OrcCorruptionException(orcDataSourceId, "Checksum mismatch for row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } }</code><technical_language>if wanna put this check in isLowMemoryMode in case miss give false alert. For example (the metadata reader strips out string stats min/max = null causing hash result). affect production runs</technical_language>

Target:
public void validateRowGroupStatistics( OrcDataSourceId orcDataSourceId, long stripeOffset, int rowGroupIndex, List<ColumnStatistics> actual) throws OrcCorruptionException { List<RowGroupStatistics> rowGroups = rowGroupStatistics.get(stripeOffset); if (rowGroups == null) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected stripe at offset %s", stripeOffset); } if (rowGroups.size() <= rowGroupIndex) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } RowGroupStatistics expectedRowGroup = rowGroups.get(rowGroupIndex); RowGroupStatistics actualRowGroup = new RowGroupStatistics(BOTH, IntStream.range(1, actual.size()).boxed().collect(toImmutableMap(identity(), actual::get))); if (expectedRowGroup.getValidationMode() != HASHED) { Map<Integer, ColumnStatistics> expectedByColumnIndex = expectedRowGroup.getColumnStatistics(); List<ColumnStatistics> expected = IntStream.range(1, actual.size()) .mapToObj(expectedByColumnIndex::get) .collect(toImmutableList()); actual = actual.subList(1, actual.size()); validateColumnStatisticsEquivalent(orcDataSourceId, "Row group " + rowGroupIndex + " in stripe at offset " + stripeOffset, actual, expected); } if (expectedRowGroup.getValidationMode() != DETAILED) { if (expectedRowGroup.getHash() != actualRowGroup.getHash()) { throw new OrcCorruptionException(orcDataSourceId, "Checksum mismatch for row group %s in stripe at offset %s", rowGroupIndex, stripeOffset); } } }