{"record":{"id":"eeaef8534797ac93","repo":"prestodb/presto","slug":"unexpected-row-group-count-stripe-in-at-offset-s","errorCode":null,"errorMessage":"Unexpected row group count stripe in at offset %s","messagePattern":"Unexpected row group count stripe in at offset (.+?)","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java","lineNumber":285,"sourceCode":"        if (expected == null) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Unexpected stripe at offset %s\", stripeOffset);\n        }\n        validateColumnStatisticsEquivalent(orcDataSourceId, \"Stripe at \" + stripeOffset, actual, expected.getColumnStatistics());\n    }\n\n    public void validateRowGroupStatistics(OrcDataSourceId orcDataSourceId, long stripeOffset, Map<StreamId, List<RowGroupIndex>> actualRowGroupStatistics)\n            throws OrcCorruptionException\n    {\n        requireNonNull(actualRowGroupStatistics, \"actualRowGroupStatistics is null\");\n        List<RowGroupStatistics> expectedRowGroupStatistics = rowGroupStatistics.get(stripeOffset);\n        if (expectedRowGroupStatistics == null) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Missing row group column statistics for stripe at offset %s\", stripeOffset);\n        }\n\n        int rowGroupCount = expectedRowGroupStatistics.size();\n        for (Entry<StreamId, List<RowGroupIndex>> entry : actualRowGroupStatistics.entrySet()) {\n            if (entry.getValue().size() != rowGroupCount) {\n                throw new OrcCorruptionException(orcDataSourceId, \"Unexpected row group count stripe in at offset %s\", stripeOffset);\n            }\n        }\n\n        for (int rowGroupIndex = 0; rowGroupIndex < expectedRowGroupStatistics.size(); rowGroupIndex++) {\n            RowGroupStatistics expectedRowGroup = expectedRowGroupStatistics.get(rowGroupIndex);\n            if (expectedRowGroup.getValidationMode() != HASHED) {\n                Map<Integer, ColumnStatistics> expectedStatistics = expectedRowGroup.getColumnStatistics();\n                Map<Integer, ColumnStatistics> actualStatistics = aggregateRowGroupStatisticsFromRowIndex(orcDataSourceId, actualRowGroupStatistics, stripeOffset, rowGroupIndex);\n\n                // remove empty row group stats for empty flat maps\n                expectedStatistics = adjustRowGroupStatisticsForFlatMaps(orcDataSourceId, stripeOffset, expectedStatistics);\n                actualStatistics = adjustRowGroupStatisticsForFlatMaps(orcDataSourceId, stripeOffset, actualStatistics);\n\n                Set<Integer> actualColumns = actualStatistics.keySet();\n                Set<Integer> expectedColumns = expectedStatistics.keySet();\n\n                if (!expectedColumns.equals(actualColumns)) {\n                    throw new OrcCorruptionException(orcDataSourceId, \"Unexpected column in row group %s in stripe at offset %s\", rowGroupIndex, stripeOffset);","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java#L267-L303","documentation":"Write-validation error: the number of row groups found for a stripe at the given offset differs from the expected count. The on-disk row-group index diverges from the writer's record — an internal consistency check firing during post-write validation, usually indicating corruption or a writer bug.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:285 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reproduce with orc writer validation to confirm","Report as a Presto ORC bug if consistent","Rewrite the affected file(s)"],"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"}