prestodb/presto · error · PrestoException

HIVE_CANNOT_OPEN_SPLIT

HIVE_CANNOT_OPEN_SPLIT

Error message

Error opening Hive split %s (offset=%s, length=%s): %s

What it means

This is the fallback branch of mapToPrestoException: any exception opening a Hive Parquet split that is not 'Filesystem closed', FileNotFoundException, BlockMissingException, or HiddenColumnException is wrapped as HIVE_CANNOT_OPEN_SPLIT with a message containing the split path, offset and length. It is a generic wrapper for all other split-open failures.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/parquet/ParquetPageSourceFactoryUtils.java:61

            throw new PrestoException(HIVE_BAD_DATA, e);
        }
        if (e instanceof AccessControlException) {
            throw new PrestoException(PERMISSION_DENIED, e.getMessage(), e);
        }
        if (nullToEmpty(e.getMessage()).trim().equals("Filesystem closed") ||
                e instanceof FileNotFoundException) {
            throw new PrestoException(HIVE_CANNOT_OPEN_SPLIT, e);
        }
        String message = format("Error opening Hive split %s (offset=%s, length=%s): %s", path, fileSplit.getStart(), fileSplit.getLength(), e.getMessage());
        if (e.getClass().getSimpleName().equals("BlockMissingException")) {
            throw new PrestoException(HIVE_MISSING_DATA, message, e);
        }
        if (e instanceof HiddenColumnException) {
            message = format("User does not have access to encryption key for encrypted column = %s. If returning 'null' for encrypted " +
                    "columns is acceptable to your query, please add 'set session hive.read_null_masked_parquet_encrypted_value_enabled=true' before your query", ((HiddenColumnException) e).getColumn());
            throw new PrestoException(PERMISSION_DENIED, message, e);
        }
        throw new PrestoException(HIVE_CANNOT_OPEN_SPLIT, message, e);
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the wrapped cause ('Caused by') in the message to identify the real underlying failure
  2. Verify the file exists and is a regular file at the split path, and that the NameNode/storage endpoint is reachable from the worker
  3. Check authentication: re-authenticate (kinit) or refresh delegation tokens/Hive metastore credentials
  4. For cloud storage, verify connector properties (endpoint, credentials, region) and retry after fixing configuration

Example fix

// before: split path points at a directory after a misconfigured partition location
ALTER TABLE t SET LOCATION 'hdfs:///data/t/'; -- files in nested dirs not matching pattern
// after
ALTER TABLE t SET LOCATION 'hdfs:///data/t/ds=2026-01-01'; -- point to the actual parquet files' parent
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: the split path must exist, be a regular file, and be readable
FileSystem fs = path.getFileSystem(conf);
if (!fs.exists(path)) throw new IllegalStateException("Split path missing: " + path);
if (!fs.getFileStatus(path).isFile()) throw new IllegalStateException("Not a file: " + path);
FSDataInputStream in = fs.open(path); in.close(); // auth/connectivity probe

Try / catch

try {
    readSplit(split);
} catch (PrestoException e) {
    if (HIVE_CANNOT_OPEN_SPLIT.equals(e.getErrorCode())) {
        Throwable cause = e.getCause();
        LOG.warn("Cannot open split %s, cause=%s", split.getPath(), cause);
        retryWithBackoffOrRequeue(split, cause); // auth refresh / endpoint re-check / retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: hdfs open of the split throws any other IOException/RuntimeException — e.g. connectivity failures to the NameNode, InvalidInputException (path is a directory/not a file), checksum errors, auth/token expiry (not classified as FileNotFoundException), S3/ABFS client errors when the table is not actually on HDFS.

Common situations: NameNode unreachable or in safemode; Kerberos/DelegationToken expired mid-query; file removed while query was planning (but path pattern still resolves oddly); reading HDFS-backed tables from a cluster whose core-site/HA config is wrong; cloud-storage (S3) misconfiguration surfaced as a generic IOException.

Related errors


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