prestodb/presto · error · PrestoException

HIVE_FILESYSTEM_ERROR

HIVE_FILESYSTEM_ERROR

Error message

Error reading from %s at position %s. 

What it means

In HdfsOrcDataSource.readInternal, a generic IOException (anything that is not BlockMissingException) during an ORC read is wrapped into PrestoException(HIVE_FILESYSTEM_ERROR) with a message including the data source and position plus the underlying IOException message. It signals a filesystem-level I/O failure rather than missing data.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/orc/HdfsOrcDataSource.java:77

    @Override
    protected void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength)
    {
        try {
            long readStart = System.nanoTime();
            inputStream.readFully(position, buffer, bufferOffset, bufferLength);
            stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart);
        }
        catch (PrestoException e) {
            // just in case there is a Presto wrapper or hook
            throw e;
        }
        catch (Exception e) {
            String message = format("Error reading from %s at position %s. ", this, position);
            if (e.getClass().getSimpleName().equals("BlockMissingException")) {
                throw new PrestoException(HIVE_MISSING_DATA, message, e);
            }
            if (e instanceof IOException) {
                throw new PrestoException(HIVE_FILESYSTEM_ERROR, message + e.getMessage(), e);
            }
            throw new PrestoException(HIVE_UNKNOWN_ERROR, message, e);
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the wrapped cause message to identify the exact IOException (EOF vs file-not-found vs timeout)
  2. Verify the file still exists and is intact: hadoop fs -ls / -cat / fsck on the path
  3. Check network/datanode connectivity from the Presto worker and HDFS client timeouts (dfs.client.socket-timeout)
  4. Re-run the query once the filesystem issue is fixed; avoid overwriting tables while queries read them

Example fix

// before
SELECT * FROM t; -- HIVE_FILESYSTEM_ERROR: Error reading from ... at position ...

// after (verify then retry)
-- hadoop fs -ls /warehouse/t/part-0  # confirm exists and non-zero
SELECT * FROM t;
Defensive patterns

Strategy: retry

Validate before calling

# confirm the file exists and is readable before/at query time
hadoop fs -test -e /warehouse/t/part-0 && hadoop fs -du -h /warehouse/t/part-0

Try / catch

try {
    return query(sql);
} catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("HIVE_FILESYSTEM_ERROR")) {
        // transient IO: bounded retry; permanent issues need the wrapped cause fixed
        return withRetry(sql, 3, backoffWithJitter());
    }
    throw e;
}

Prevention

When it happens

Trigger: read() at `position` throws IOException subclasses like EOFException, FileNotFoundException, or local-RPC/socket errors that are not BlockMissingException.

Common situations: File deleted/truncated while the query runs; HDFS client timeouts under heavy load; permission/AuthException on the file; network partitions between Presto worker and datanode; split pointing at a path that no longer exists (partition overwritten mid-query).

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/45ca0247461af3bc. Report an issue: GitHub.