{"record":{"id":"8bf45fbf96924a7f","repo":"prestodb/presto","slug":"write-validation-failed-unexpected-decimal-range","errorCode":null,"errorMessage":"Write validation failed: unexpected decimal range in %s statistics","messagePattern":"Write validation failed: unexpected decimal range in (.+?) statistics","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java","lineNumber":583,"sourceCode":"                    expectedStringStatistics.getSum());\n        }\n        StringStatistics actualStringStatistics = actualColumnStatistics.getStringStatistics();\n        if (!Objects.equals(actualColumnStatistics.getStringStatistics(), expectedStringStatistics) && expectedStringStatistics != null) {\n            // expectedStringStatistics (or the min/max of it) could be null while the actual one might not because\n            // expectedStringStatistics is calculated by merging all row group stats in the stripe but the actual one is by scanning each row in the stripe on disk.\n            // Merging row group stats can produce nulls given we have string stats limit.\n            if (actualStringStatistics == null ||\n                    actualStringStatistics.getSum() != expectedStringStatistics.getSum() ||\n                    (expectedStringStatistics.getMax() != null && !Objects.equals(actualStringStatistics.getMax(), expectedStringStatistics.getMax())) ||\n                    (expectedStringStatistics.getMin() != null && !Objects.equals(actualStringStatistics.getMin(), expectedStringStatistics.getMin()))) {\n                throw new OrcCorruptionException(orcDataSourceId, \"Write validation failed: unexpected string range in %s statistics\", name);\n            }\n        }\n        if (!Objects.equals(actualColumnStatistics.getDateStatistics(), expectedColumnStatistics.getDateStatistics())) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Write validation failed: unexpected date range in %s statistics\", name);\n        }\n        if (!Objects.equals(actualColumnStatistics.getDecimalStatistics(), expectedColumnStatistics.getDecimalStatistics())) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Write validation failed: unexpected decimal range in %s statistics\", name);\n        }\n        if (!Objects.equals(actualColumnStatistics.getBloomFilter(), expectedColumnStatistics.getBloomFilter())) {\n            throw new OrcCorruptionException(orcDataSourceId, \"Write validation failed: unexpected bloom filter in %s statistics\", name);\n        }\n    }\n\n    public static class WriteChecksum\n    {\n        private final long totalRowCount;\n        private final long stripeHash;\n        private final List<Long> columnHashes;\n\n        public WriteChecksum(long totalRowCount, long stripeHash, List<Long> columnHashes)\n        {\n            this.totalRowCount = totalRowCount;\n            this.stripeHash = stripeHash;\n            this.columnHashes = columnHashes;\n        }","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java#L565-L601","documentation":"Write-validation error: the decimal statistics for a column do not match expectations — actual vs expected min/max/sum decimal stats differ beyond the writer's tolerated merging differences. The %s names the statistics section; flags decimal stats divergence between write-time record and file content.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:583 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as an ORC writer bug if reproducible","Verify decimal precision/scale consistency across the write","Rewrite the dataset and re-run validation"],"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"}