{"record":{"id":"81507f68e9ccbc48","repo":"prestodb/presto","slug":"write-validation-failed-unexpected-date-range-in","errorCode":null,"errorMessage":"Write validation failed: unexpected date range in %s statistics","messagePattern":"Write validation failed: unexpected date range in (.+?) statistics","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java","lineNumber":580,"sourceCode":"                    maxStringTruncateToValidRange(expectedStringStatistics.getMax(), HiveWriterVersion.ORC_HIVE_8732),\n                    expectedStringStatistics.isLowerBoundSet(),\n                    expectedStringStatistics.isUpperBoundSet(),\n                    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;","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java#L562-L598","documentation":"Write-validation error: the date statistics (min/max) recorded for a column in the re-read file fall outside the expected range (e.g. outside valid epoch-day bounds after truncation rules). The %s identifies which statistics section (file/stripe/row group) failed; indicates date stats inconsistency in the written file.","triggerScenarios":"Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcWriteValidation.java:580 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report as an ORC writer bug with validation logs","Check for extreme/invalid date values in the source data","Rewrite the file and re-validate"],"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"}