{"record":{"id":"0c26e8425b3d69ee","repo":"prestodb/presto","slug":"hive-writer-data-error-0c26e8","errorCode":"HIVE_WRITER_DATA_ERROR","errorMessage":"Failed to read temporary data","messagePattern":"Failed to read temporary data","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/util/TempFileReader.java","lineNumber":88,"sourceCode":"                    false,\n                    NO_ENCRYPTION,\n                    DwrfKeyProvider.EMPTY,\n                    new RuntimeStats());\n\n            Map<Integer, Type> includedColumns = new HashMap<>();\n            for (int i = 0; i < types.size(); i++) {\n                includedColumns.put(i, types.get(i));\n            }\n\n            reader = orcReader.createBatchRecordReader(\n                    includedColumns,\n                    OrcPredicate.TRUE,\n                    UTC,\n                    new HiveOrcAggregatedMemoryContext(),\n                    INITIAL_BATCH_SIZE);\n        }\n        catch (IOException e) {\n            throw new PrestoException(HIVE_WRITER_DATA_ERROR, \"Failed to read temporary data\");\n        }\n    }\n\n    @Override\n    protected Page computeNext()\n    {\n        try {\n            if (Thread.currentThread().isInterrupted()) {\n                throw new InterruptedIOException();\n            }\n\n            int batchSize = reader.nextBatch();\n            if (batchSize <= 0) {\n                return endOfData();\n            }\n\n            Block[] blocks = new Block[columnCount];\n            for (int i = 0; i < columnCount; i++) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/util/TempFileReader.java#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before creating TempFileReader\nFile f = new File(tempPath);\nif (!f.exists() || f.length() == 0) {\n    throw new SkipException(\"temp file missing or empty: \" + tempPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n    reader = new TempFileReader(...);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == HIVE_WRITER_DATA_ERROR.toErrorCode().getCode()) {\n        // log and retry once on a healthy worker\n    }\n}","preventionTips":["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."],"tags":["hive","orc","io","spill"],"backgroundTag":"temp-file-read-failed","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"}