prestodb/presto · error · PrestoException
HIVE_WRITER_CLOSE_ERROR
HIVE_WRITER_CLOSE_ERROR
Error message
Error committing write to Hive
What it means
SortingFileWriter.commit() first writes all buffered input in sorted order into the underlying output writer, then delegates commit to it. If the sorting/write phase throws UncheckedIOException, it is wrapped in HIVE_WRITER_CLOSE_ERROR with this message. The sorted output could not be produced or finalized, so the write fails at commit time.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/SortingFileWriter.java:144
@Override
public Optional<Page> commit()
{
if (!sortBuffer.isEmpty()) {
// skip temporary files entirely if the total output size is small
if (tempFiles.isEmpty()) {
sortBuffer.flushTo(outputWriter::appendRows);
return outputWriter.commit();
}
flushToTempFile();
}
try {
writeSorted();
return outputWriter.commit();
}
catch (UncheckedIOException e) {
throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error committing write to Hive", e);
}
}
@Override
public void rollback()
{
if (!sortedWriteToTempPathEnabled) {
for (TempFile file : tempFiles) {
cleanupFile(file.getPath());
}
}
outputWriter.rollback();
}
@Override
public long getValidationCpuNanos()
{View on GitHub (pinned to 55bb57d202)
Solutions
- Check local disk space for spill/temp directories and HDFS write health, then retry.
- Reduce per-task sort size: increase writer count, lower per-task data volume, or split the INSERT.
- Tune sort/writer memory configuration so writeSorted() does not exhaust buffers.
- Inspect the wrapped UncheckedIOException for the precise I/O failure (disk, permissions, HDFS).
Defensive patterns
Strategy: retry
Try / catch
try {
executeInsert(sql);
} catch (PrestoException e) {
if (e.getErrorCode() == HiveErrorCode.HIVE_WRITER_CLOSE_ERROR.toErrorCode().getId()) {
// check local spill disk space and HDFS health, then retry with reduced sort size
}
} Prevention
- Monitor local temp/spill disk space on nodes running sorted writes.
- Avoid single-partition inserts large enough to exhaust sort buffers.
- Tune sort buffer/writer memory settings for your workload sizes.
When it happens
Trigger: commit() on an INSERT using sorted output (sort properties on the table/session) where writeSorted() hits an I/O failure — e.g. disk full when spilling sorted data, or the underlying writer fails while writing sorted rows or committing.
Common situations: Very large single-partition sorts exhausting local temp/spill disk; HDFS write failure during the final sorted output; misconfigured sort memory buffers causing heavy spilling and eventual I/O errors; slow/unstable disks on temp space.
Related errors
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_OPEN_ERROR
- HIVE_WRITER_CLOSE_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/feb9dde384503170.
Report an issue: GitHub.