{"record":{"id":"c7998d05c165fa0e","repo":"apache/seatunnel","slug":"failed-to-derive-qualified-default-table-location","errorCode":null,"errorMessage":"Failed to derive qualified default table location, fallback to file:/tmp/hive/warehouse: {}","messagePattern":"Failed to derive qualified default table location, fallback to file:/tmp/hive/warehouse: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSink.java","lineNumber":323,"sourceCode":"        readonlyConfig\n                .getOptional(HiveSinkOptions.KERBEROS_PRINCIPAL)\n                .ifPresent(hadoopConf::setKerberosPrincipal);\n        readonlyConfig\n                .getOptional(HiveSinkOptions.KERBEROS_KEYTAB_PATH)\n                .ifPresent(hadoopConf::setKerberosKeytabPath);\n        return hadoopConf;\n    }\n\n    // Try to read from configuration, qualify default location via HiveLocationUtils\n    private String getDefaultTableLocation(ReadonlyConfig config) {\n        try {\n            String table = config.get(HiveSinkOptions.TABLE_NAME);\n            org.apache.seatunnel.api.table.catalog.TablePath path =\n                    org.apache.seatunnel.api.table.catalog.TablePath.of(table);\n            return org.apache.seatunnel.connectors.seatunnel.hive.utils.HiveLocationUtils\n                    .qualifiedDefaultLocation(config, path.getDatabaseName(), path.getTableName());\n        } catch (Exception e) {\n            LOGGER.warn(\n                    \"Failed to derive qualified default table location, fallback to file:/tmp/hive/warehouse: {}\",\n                    e.getMessage());\n            return \"file:/tmp/hive/warehouse\";\n        }\n    }\n\n    private Table getTableInformation() {\n        if (tableInformation == null) {\n            try {\n                tableInformation = HiveTableUtils.getTableInfo(readonlyConfig);\n            } catch (Exception e) {\n                LOGGER.warn(\n                        \"Hive table not available yet or metastore not reachable: {}. Will continue with lazy creation via SaveMode.\",\n                        e.getMessage());\n                tableInformation = null;\n            }\n        }\n        return tableInformation;","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSink.java#L305-L341","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set an explicit table location in the sink config so the default derivation is not needed","Ensure 'hive.metastore.warehouse.dir' is set in hive-site.xml or hadoop conf available to the job","Verify TABLE_NAME uses the format 'database.table' and is valid","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"],"exampleFix":"// before\nsink {\n  Hive {\n    table_name = \"mytable\"\n  }\n}\n// after\nsink {\n  Hive {\n    table_name = \"default.mytable\"\n    # or configure warehouse dir in hive-site.xml on the classpath\n  }\n}","handlingStrategy":"validation","validationCode":"// check config before submitting\nString table = config.get(HiveSinkOptions.TABLE_NAME);\nif (!table.contains(\".\")) throw new IllegalArgumentException(\"TABLE_NAME must be database.table\");\n// ensure warehouse dir resolves\nFileSystem.get(URI.create(warehouseDir), hadoopConf).exists(new Path(warehouseDir));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always qualify table names as database.table","Set hive.metastore.warehouse.dir in conf available to the job","Prefer explicit location in sink config over warehouse derivation","Inspect created table LOCATION after first run to avoid silent local-disk fallback"],"tags":["hive","fallback","warehouse","hadoop"],"backgroundTag":"missing-config-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}