prestodb/presto · error · OrcCorruptionException
Write validation failed:
Error message
Write validation failed:
What it means
validateWrite evaluates a Predicate against the OrcWriteValidation collected during a write. If validation is present and the predicate fails, the written file did not meet expectations and OrcCorruptionException is thrown with the caller-provided formatted message.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcReader.java:526
OrcPredicate.TRUE,
hiveStorageTimeZone,
NOOP_ORC_AGGREGATED_MEMORY_CONTEXT,
INITIAL_BATCH_SIZE)) {
while (orcRecordReader.nextBatch() >= 0) {
// ignored
}
}
}
catch (IOException e) {
throw new OrcCorruptionException(e, input.getId(), "Validation failed");
}
}
public static void validateWrite(Optional<OrcWriteValidation> writeValidation, OrcDataSource orcDataSource, Predicate<OrcWriteValidation> test, String messageFormat, Object... args)
throws OrcCorruptionException
{
if (writeValidation.isPresent() && !test.test(writeValidation.get())) {
throw new OrcCorruptionException(orcDataSource.getId(), "Write validation failed: " + messageFormat, args);
}
}
public OrcDataSource getOrcDataSource()
{
return orcDataSource;
}
public StripeFooter readStripeFooter(StripeInformation stripe)
throws IOException
{
requireNonNull(stripe, "stripe is null");
byte[] tailBuffer = new byte[toIntExact(stripe.getFooterLength())];
orcDataSource.readFully(stripe.getOffset() + stripe.getIndexLength() + stripe.getDataLength(), tailBuffer);
try (InputStream inputStream = new OrcInputStream(
orcDataSource.getId(),
new SharedBuffer(NOOP_ORC_LOCAL_MEMORY_CONTEXT),View on GitHub (pinned to 55bb57d202)
Solutions
- Read the formatted message args to see which validation predicate failed
- Rewrite the ORC file with validation enabled to catch the writer bug
- Compare writer version and reader validation expectations
- Disable specific write validations only after identifying the root cause
Defensive patterns
Strategy: try-catch
Try / catch
try {
OrcReader.validateWrite(validation, dataSource, predicate, "stripe count mismatch");
}
catch (OrcCorruptionException e) {
LOG.error("Write validation: " + e.getMessage(), e); // args detail the failed predicate
} Prevention
- Run validateWrite on every written file in staging
- Keep writer versions consistent within a pipeline
- Record stripe/metadata expectations at write time
When it happens
Trigger: Static call OrcReader.validateWrite with Optional<OrcWriteValidation> present and test.test(...) returning false — typically invoked from post-write checks comparing stripes, metadata, or checksums.
Common situations: Writer bugs producing fewer stripes/rows than recorded, metadata mismatches after rewrite, checksum inconsistencies detected by the validation framework.
Related errors
- INVALID_SESSION_PROPERTY
- Write-side compression verification failed: %s (uncompressed
- Write-side compression verification failed: chunk does not d
- Validation failed
- NOT_SUPPORTED
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/637316ddd05b5cd6.
Report an issue: GitHub.