{"record":{"id":"45bcb7396082169e","repo":"prestodb/presto","slug":"could-not-find-stripe-statistics-for-a-stripe-at-o","errorCode":null,"errorMessage":"Could not find stripe statistics for a stripe at offset %s","messagePattern":"Could not find stripe statistics for a stripe at offset (.+?)","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java","lineNumber":337,"sourceCode":"                if (adjustedExpectedRowGroup.getHash() != actualRowGroup.getHash()) {\n                    throw new OrcCorruptionException(orcDataSourceId, \"Checksum mismatch for row group %s in stripe at offset %s\", rowGroupIndex, stripeOffset);\n                }\n            }\n        }\n    }\n\n    private Map<Integer, ColumnStatistics> adjustRowGroupStatisticsForFlatMaps(OrcDataSourceId orcDataSourceId, long stripeOffset, Map<Integer, ColumnStatistics> stats)\n    {\n        if (this.flattenedKeyToMapNodes.isEmpty()) {\n            return stats;\n        }\n\n        // The only reliable way to detect that a flat map doesn't have non-null & non-empty\n        // values is to check the stripe stats for the key node. If it has 0 number of values\n        // it means that this flat map writer didn't write anything.\n        StripeStatistics stripeStats = this.stripeStatistics.get(stripeOffset);\n        if (stripeStats == null) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Could not find stripe statistics for a stripe at offset %s\", stripeOffset);\n        }\n\n        List<ColumnStatistics> allStripeColumnStatistics = stripeStats.getColumnStatistics();\n        Set<Integer> excludedNodes = new HashSet<>();\n        for (Entry<Integer, Integer> keyToMapNodeEntry : flattenedKeyToMapNodes.entrySet()) {\n            int keyNode = keyToMapNodeEntry.getKey();\n\n            ColumnStatistics stripeColumnStat = allStripeColumnStatistics.get(keyNode);\n            if (stripeColumnStat.getNumberOfValues() == 0) {\n                // This flat map column writer didn't write any key/value.\n                // Go over all value nodes for this flat map and check that they\n                // have 0 values before marking them as excluded.\n                Integer mapNode = keyToMapNodeEntry.getValue();\n                Set<Integer> valueNodes = flattenedMapToValueNodes.get(mapNode);\n                for (int valueNode : valueNodes) {\n                    ColumnStatistics valueColumnStat = allStripeColumnStatistics.get(valueNode);\n                    if (valueColumnStat.getNumberOfValues() != 0) {\n                        throw new OrcCorruptionException(","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java#L319-L355","documentation":"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.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:337 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reproduce with validation enabled and report as an ORC writer bug","Avoid flat-map validation mode on this data as a workaround","Rewrite the affected file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}