{"record":{"id":"e4547a0b9c05657d","repo":"prestodb/presto","slug":"write-validation-failed-unexpected-number-of-colu","errorCode":null,"errorMessage":"Write validation failed: unexpected number of columns in stripe statistics","messagePattern":"Write validation failed: unexpected number of columns in stripe statistics","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java","lineNumber":253,"sourceCode":"    public void validateFileStatistics(OrcDataSourceId orcDataSourceId, List<ColumnStatistics> actualFileStatistics)\n            throws OrcCorruptionException\n    {\n        validateColumnStatisticsEquivalent(orcDataSourceId, \"file\", actualFileStatistics, fileStatistics);\n    }\n\n    public void validateStripeStatistics(OrcDataSourceId orcDataSourceId, List<StripeInformation> actualStripes, List<StripeStatistics> actualStripeStatistics)\n            throws OrcCorruptionException\n    {\n        requireNonNull(actualStripes, \"actualStripes is null\");\n        requireNonNull(actualStripeStatistics, \"actualStripeStatistics is null\");\n\n        if (isDwrf()) {\n            // DWRF does not have stripe statistics\n            return;\n        }\n\n        if (actualStripeStatistics.size() != stripeStatistics.size()) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Write validation failed: unexpected number of columns in stripe statistics\");\n        }\n\n        for (int stripeIndex = 0; stripeIndex < actualStripes.size(); stripeIndex++) {\n            long stripeOffset = actualStripes.get(stripeIndex).getOffset();\n            StripeStatistics actual = actualStripeStatistics.get(stripeIndex);\n            validateStripeStatistics(orcDataSourceId, stripeOffset, actual.getColumnStatistics());\n        }\n    }\n\n    public void validateStripeStatistics(OrcDataSourceId orcDataSourceId, long stripeOffset, List<ColumnStatistics> actual)\n            throws OrcCorruptionException\n    {\n        StripeStatistics expected = stripeStatistics.get(stripeOffset);\n        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    }","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java#L235-L271","documentation":"Write-validation error: the number of column statistics entries in the file's stripe statistics differs from what the writer recorded. Raised while re-reading the file after writing with validation on; indicates the stripe-statistics section does not match the writer's bookkeeping (corruption or writer bug).","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the job producing the file and check for reproducibility","Report as an ORC writer bug with the validation stack trace","Validate the file with an external ORC tool to confirm corruption"],"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"}