prestodb/presto · error · OrcCorruptionException

Could not find stripe statistics for a stripe at offset %s

Error message

Could not find stripe statistics for a stripe at offset %s

What it means

Write-validation error during flat-map statistics adjustment: no stripe statistics entry exists for a stripe at the given offset even though the file layout implies one. A lookup guard in adjustRowGroupStatisticsForFlatMaps — the writer's expected stripe stats are missing, indicating bookkeeping divergence.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:337

                if (adjustedExpectedRowGroup.getHash() != actualRowGroup.getHash()) {
                    throw new OrcCorruptionException(orcDataSourceId, "Checksum mismatch for row group %s in stripe at offset %s", rowGroupIndex, stripeOffset);
                }
            }
        }
    }

    private Map<Integer, ColumnStatistics> adjustRowGroupStatisticsForFlatMaps(OrcDataSourceId orcDataSourceId, long stripeOffset, Map<Integer, ColumnStatistics> stats)
    {
        if (this.flattenedKeyToMapNodes.isEmpty()) {
            return stats;
        }

        // The only reliable way to detect that a flat map doesn't have non-null & non-empty
        // values is to check the stripe stats for the key node. If it has 0 number of values
        // it means that this flat map writer didn't write anything.
        StripeStatistics stripeStats = this.stripeStatistics.get(stripeOffset);
        if (stripeStats == null) {
            throw new OrcCorruptionException(orcDataSourceId, "Could not find stripe statistics for a stripe at offset %s", stripeOffset);
        }

        List<ColumnStatistics> allStripeColumnStatistics = stripeStats.getColumnStatistics();
        Set<Integer> excludedNodes = new HashSet<>();
        for (Entry<Integer, Integer> keyToMapNodeEntry : flattenedKeyToMapNodes.entrySet()) {
            int keyNode = keyToMapNodeEntry.getKey();

            ColumnStatistics stripeColumnStat = allStripeColumnStatistics.get(keyNode);
            if (stripeColumnStat.getNumberOfValues() == 0) {
                // This flat map column writer didn't write any key/value.
                // Go over all value nodes for this flat map and check that they
                // have 0 values before marking them as excluded.
                Integer mapNode = keyToMapNodeEntry.getValue();
                Set<Integer> valueNodes = flattenedMapToValueNodes.get(mapNode);
                for (int valueNode : valueNodes) {
                    ColumnStatistics valueColumnStat = allStripeColumnStatistics.get(valueNode);
                    if (valueColumnStat.getNumberOfValues() != 0) {
                        throw new OrcCorruptionException(

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Reproduce with validation enabled and report as an ORC writer bug
  2. Avoid flat-map validation mode on this data as a workaround
  3. Rewrite the affected file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:337 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/45bcb7396082169e. Report an issue: GitHub.