prestodb/presto · error · PrestoException

HIVE_FILESYSTEM_ERROR

HIVE_FILESYSTEM_ERROR

Error message

Failed getting FileSystem: 

What it means

GenericHiveRecordCursorProvider.createRecordCursor calls hdfsEnvironment.getFileSystem(...) to validate that a FileSystem can be obtained for the split's path before creating the RecordReader. Any IOException there is wrapped as a PrestoException with HIVE_FILESYSTEM_ERROR, meaning Presto could not access the underlying file system (HDFS, S3, Azure, etc.) for this file.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursorProvider.java:74

            DateTimeZone hiveStorageTimeZone,
            TypeManager typeManager,
            boolean s3SelectPushdownEnabled)
    {
        // make sure the FileSystem is created with the proper Configuration object
        Path path = new Path(fileSplit.getPath());
        try {
            if (!fileSplit.getCustomSplitInfo().isEmpty()) {
                if (configuration instanceof HiveCachingHdfsConfiguration.CachingJobConf) {
                    configuration = ((HiveCachingHdfsConfiguration.CachingJobConf) configuration).getConfig();
                }
                if (configuration instanceof CopyOnFirstWriteConfiguration) {
                    configuration = ((CopyOnFirstWriteConfiguration) configuration).getConfig();
                }
            }
            this.hdfsEnvironment.getFileSystem(session.getUser(), path, configuration);
        }
        catch (IOException e) {
            throw new PrestoException(HIVE_FILESYSTEM_ERROR, "Failed getting FileSystem: " + path, e);
        }

        Configuration actualConfiguration = configuration;

        RecordReader<?, ?> recordReader = hdfsEnvironment.doAs(session.getUser(),
                () -> HiveUtil.createRecordReader(actualConfiguration, path, fileSplit.getStart(), fileSplit.getLength(), schema, columns, fileSplit.getCustomSplitInfo()));
        return hdfsEnvironment.doAs(session.getUser(),
                () -> Optional.of(new GenericHiveRecordCursor<>(
                        session,
                        actualConfiguration,
                        path,
                        genericRecordReader(recordReader),
                        fileSplit.getLength(),
                        schema,
                        columns,
                        hiveStorageTimeZone,
                        typeManager)));
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table/partition location URI is reachable: check the NameNode is up and the host:port in the path resolves.
  2. Confirm the filesystem scheme is supported and configured (fs.defaultFS, fs.hdfs.impl, or S3 endpoint/credentials in the connector properties).
  3. Check permissions/Kerberos: ensure the Presto user can access the path and tokens are valid (retry after re-authentication).
  4. Confirm the file still exists; if the location was moved, update the table/partition metadata (e.g. ALTER TABLE ... SET LOCATION or MSCK REPAIR).
  5. Inspect the wrapped cause in the PrestoException for the root IOException and address it specifically.

Example fix

// before (table points at dead NameNode)
LOCATION 'hdfs://old-nn:9000/warehouse/orders';
// after
ALTER TABLE orders SET LOCATION 'hdfs://new-nn:8020/warehouse/orders';
Defensive patterns

Strategy: try-catch

Validate before calling

// check the table location is reachable before querying
Path path = new Path(tableLocation);
FileSystem fs = path.getFileSystem(conf);
if (!fs.exists(path)) {
    throw new IllegalStateException("Location missing: " + path);
}

Try / catch

try {
    return cursorProvider.createRecordCursor(...);
} catch (PrestoException e) {
    if (HIVE_FILESYSTEM_ERROR.toErrorCode().equals(e.getErrorCode())) {
        // inspect e.getCause() (IOException) for NameNode/S3/Kerberos root cause
        throw new RuntimeException("Hive filesystem unavailable for " + path, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: hdfsEnvironment.getFileSystem(session.getUser(), path, configuration) throws IOException while preparing a record cursor for a Hive split — e.g. bad NameNode URI, missing/wrong filesystem scheme, Kerberos/token failures surfaced as IOException, or unresolvable HDFS host.

Common situations: HDFS NameNode down or moved (stale table location); S3 credentials/bucket misconfiguration; unknown host in hdfs:// URI; permission or Kerberos issues; file deleted between split scheduling and reading; configs without the scheme's FileSystem implementation on the classpath.

Related errors


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