apache/seatunnel · warning

Failed to derive qualified default table location, fallback

Error message

Failed to derive qualified default table location, fallback to file:/tmp/hive/warehouse: {}

What it means

HiveSink.getDefaultTableLocation derives the default warehouse location for a table that has no explicit location. If deriving a qualified default location fails (missing warehouse dir config, malformed table name, metastore config issue), it logs this warning and falls back to the literal location 'file:/tmp/hive/warehouse'.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSink.java:323

        readonlyConfig
                .getOptional(HiveSinkOptions.KERBEROS_PRINCIPAL)
                .ifPresent(hadoopConf::setKerberosPrincipal);
        readonlyConfig
                .getOptional(HiveSinkOptions.KERBEROS_KEYTAB_PATH)
                .ifPresent(hadoopConf::setKerberosKeytabPath);
        return hadoopConf;
    }

    // Try to read from configuration, qualify default location via HiveLocationUtils
    private String getDefaultTableLocation(ReadonlyConfig config) {
        try {
            String table = config.get(HiveSinkOptions.TABLE_NAME);
            org.apache.seatunnel.api.table.catalog.TablePath path =
                    org.apache.seatunnel.api.table.catalog.TablePath.of(table);
            return org.apache.seatunnel.connectors.seatunnel.hive.utils.HiveLocationUtils
                    .qualifiedDefaultLocation(config, path.getDatabaseName(), path.getTableName());
        } catch (Exception e) {
            LOGGER.warn(
                    "Failed to derive qualified default table location, fallback to file:/tmp/hive/warehouse: {}",
                    e.getMessage());
            return "file:/tmp/hive/warehouse";
        }
    }

    private Table getTableInformation() {
        if (tableInformation == null) {
            try {
                tableInformation = HiveTableUtils.getTableInfo(readonlyConfig);
            } catch (Exception e) {
                LOGGER.warn(
                        "Hive table not available yet or metastore not reachable: {}. Will continue with lazy creation via SaveMode.",
                        e.getMessage());
                tableInformation = null;
            }
        }
        return tableInformation;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set an explicit table location in the sink config so the default derivation is not needed
  2. Ensure 'hive.metastore.warehouse.dir' is set in hive-site.xml or hadoop conf available to the job
  3. Verify TABLE_NAME uses the format 'database.table' and is valid
  4. Be aware of the file:/tmp/hive/warehouse fallback — data may land on local disk instead of HDFS; check the created table location after the job

Example fix

// before
sink {
  Hive {
    table_name = "mytable"
  }
}
// after
sink {
  Hive {
    table_name = "default.mytable"
    # or configure warehouse dir in hive-site.xml on the classpath
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// check config before submitting
String table = config.get(HiveSinkOptions.TABLE_NAME);
if (!table.contains(".")) throw new IllegalArgumentException("TABLE_NAME must be database.table");
// ensure warehouse dir resolves
FileSystem.get(URI.create(warehouseDir), hadoopConf).exists(new Path(warehouseDir));

Prevention

When it happens

Trigger: getDefaultTableLocation() (called from generateFileSinkConfig/hdfsLocation) catches any Exception thrown by HiveLocationUtils.qualifiedDefaultLocation — e.g. missing hive.metastore.warehouse.dir, unparseable TABLE_NAME, or Hadoop filesystem resolution failure.

Common situations: TABLE_NAME missing database qualifier combined with no warehouse dir configured, warehouse dir pointing to an unavailable filesystem, config keys missing from hadoop conf files.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


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