prestodb/presto · error · OrcCorruptionException

Stripe at offset %s has unexpected flat map value node colum

Error message

Stripe at offset %s has unexpected flat map value node column stats with non-zero number of values

What it means

Write-validation error specific to flattened maps: a flat map's value-node column statistics report a non-zero number of values, which is inconsistent with the flattened-map writer's expectations for the recorded key set. An invariant check while adjusting row-group stats; flags writer/statistics inconsistency.

Source

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

            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(
                                orcDataSourceId,
                                "Stripe at offset %s has unexpected flat map value node column stats with non-zero number of values",
                                stripeOffset);
                    }
                    excludedNodes.add(valueNode);
                }
            }
        }

        // return original stats excluding the flat map value stats for empty flat maps
        return stats.entrySet().stream()
                .filter(e -> !excludedNodes.contains(e.getKey()))
                .collect(toImmutableMap(Entry::getKey, Entry::getValue));
    }

    private Map<Integer, ColumnStatistics> aggregateRowGroupStatisticsFromRowIndex(
            OrcDataSourceId orcDataSourceId,
            Map<StreamId, List<RowGroupIndex>> actualRowGroupStatistics,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Report as a Presto ORC writer bug with the validation stack trace
  2. Rewrite the data without flat-map optimization as a workaround
  3. Confirm flat-map reader/writer versions match
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:355 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/c384e9b0e681fa70. Report an issue: GitHub.