prestodb/presto · error · PrestoException
HIVE_WRITER_DATA_ERROR
HIVE_WRITER_DATA_ERROR
Error message
Failed to read temporary data
What it means
TempFileReader opens an ORC reader over a spilled temporary file when a Hive writer flushes intermediate data. If any IOException occurs while constructing the ORC reader (missing file, corrupt footer, permission problem), it is wrapped in a PrestoException with HIVE_WRITER_DATA_ERROR. This signals the spill/temporary data written by this query's writer is unreadable, not a user-input problem.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/util/TempFileReader.java:88
false,
NO_ENCRYPTION,
DwrfKeyProvider.EMPTY,
new RuntimeStats());
Map<Integer, Type> includedColumns = new HashMap<>();
for (int i = 0; i < types.size(); i++) {
includedColumns.put(i, types.get(i));
}
reader = orcReader.createBatchRecordReader(
includedColumns,
OrcPredicate.TRUE,
UTC,
new HiveOrcAggregatedMemoryContext(),
INITIAL_BATCH_SIZE);
}
catch (IOException e) {
throw new PrestoException(HIVE_WRITER_DATA_ERROR, "Failed to read temporary data");
}
}
@Override
protected Page computeNext()
{
try {
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedIOException();
}
int batchSize = reader.nextBatch();
if (batchSize <= 0) {
return endOfData();
}
Block[] blocks = new Block[columnCount];
for (int i = 0; i < columnCount; i++) {View on GitHub (pinned to 55bb57d202)
Solutions
- Re-run the query; transient FS errors (deleted temp file, network hiccup) often disappear on retry.
- Check that the spill/temp directory on the worker (or HDFS path) has free space and correct permissions.
- Inspect worker logs for the root IOException stack just above this PrestoException to identify the underlying FS issue.
- Check for node failures or restarts mid-query; retry after the cluster is healthy.
- If reproducible, verify all nodes run the same Presto version (spill format compatibility).
Defensive patterns
Strategy: retry
Validate before calling
// before creating TempFileReader
File f = new File(tempPath);
if (!f.exists() || f.length() == 0) {
throw new SkipException("temp file missing or empty: " + tempPath);
} Try / catch
try {
reader = new TempFileReader(...);
} catch (PrestoException e) {
if (e.getErrorCode().getCode() == HIVE_WRITER_DATA_ERROR.toErrorCode().getCode()) {
// log and retry once on a healthy worker
}
} Prevention
- Ensure spill/tmp directories have ample free space and are excluded from aggressive cleanup daemons.
- Keep worker versions uniform across the cluster to avoid spill-format incompatibilities.
- Monitor disk health and HDFS read errors on workers.
When it happens
Trigger: Calling TempFileReader's public constructor/reader setup when the underlying temp ORC file cannot be opened by the OrcReader: file deleted before read, truncated write, HDFS/local FS IOException, or wrong file format.
Common situations: Disk pressure or cleanup daemon removing /tmp spill files mid-query; node crash leaving partial temp files; HDFS short-circuit read failures; mismatched Presto versions on workers during rolling upgrade reading older spill format.
Related errors
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_OPEN_ERROR
- HIVE_FILESYSTEM_ERROR
- HIVE_FILESYSTEM_ERROR
- HIVE_CANNOT_OPEN_SPLIT
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/0c26e8425b3d69ee.
Report an issue: GitHub.