apache/seatunnel · error · HiveConnectorException

GET_HDFS_NAMENODE_HOST_FAILED

GET_HDFS_NAMENODE_HOST_FAILED

Error message

Get hdfs namenode host from table location [${hiveSdLocation}] failed,please check it

What it means

HDFSStorage.buildHadoopConfWithReadOnlyConfig derives the HDFS NameNode host from the Hive table's storage descriptor location (e.g. hdfs://nn:8020/warehouse/...). If the location string is not a valid URI (new URI(...) throws URISyntaxException), it throws GET_HDFS_NAMENODE_HOST_FAILED with the offending location interpolated into the message.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/storage/HDFSStorage.java:57

    }

    @Override
    public HadoopConf buildHadoopConfWithReadOnlyConfig(ReadonlyConfig readonlyConfig) {
        try {
            String path = new URI(hiveSdLocation).getPath();
            HadoopConf hadoopConf = new HadoopConf(hiveSdLocation.replace(path, StringUtils.EMPTY));
            Configuration configuration = loadHiveBaseHadoopConfig(readonlyConfig);
            Map<String, String> propsInConfiguration =
                    configuration.getPropsWithPrefix(StringUtils.EMPTY);
            hadoopConf.setExtraOptions(propsInConfiguration);
            return hadoopConf;
        } catch (URISyntaxException e) {
            String errorMsg =
                    String.format(
                            "Get hdfs namenode host from table location [%s] failed,"
                                    + "please check it",
                            hiveSdLocation);
            throw new HiveConnectorException(
                    HiveConnectorErrorCode.GET_HDFS_NAMENODE_HOST_FAILED, errorMsg, e);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the table location printed in the message (SHOW CREATE TABLE) and confirm it starts with hdfs://host:port.
  2. Fix the table LOCATION in Hive to a fully qualified hdfs:// URI, or set the connector's default FS so relative paths resolve.
  3. Ensure dfs.nameservices/HA config is correct if the location uses a logical nameservice (e.g. hdfs://nameservice1).
  4. If the location contains spaces or special chars, rename the directory and update the table LOCATION.

Example fix

// before (Hive)
ALTER TABLE t SET LOCATION '/user/hive/warehouse/t'
// after
ALTER TABLE t SET LOCATION 'hdfs://namenode:8020/user/hive/warehouse/t'
Defensive patterns

Strategy: validation

Validate before calling

String loc = table.getSd().getLocation();
java.net.URI uri = java.net.URI.create(loc);
if (uri.getScheme() == null || uri.getHost() == null) {
    throw new IllegalArgumentException("table location must be fully qualified hdfs://host:port URI: " + loc);
}

Try / catch

try {
    storage.hadoopConf(readonlyConfig);
} catch (HiveConnectorException e) {
    LOG.error("Fix table LOCATION to a fully qualified hdfs:// URI", e);
    throw e;
}

Prevention

When it happens

Trigger: Parsing a hiveSdLocation that lacks a scheme/host (e.g. '/warehouse/tablespace/...', 'file:/path', or contains illegal URI characters like unencoded spaces) inside buildHadoopConfWithReadOnlyConfig.

Common situations: Hive tables created with relative/local locations, migrated tables whose LOCATION lost the hdfs:// prefix, or locations containing spaces/special characters.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/41cfe1b65958dcbe. Report an issue: GitHub.