{"record":{"id":"3a213cf0612bb5df","repo":"apache/seatunnel","slug":"hive-table-name-error","errorCode":"HIVE_TABLE_NAME_ERROR","errorMessage":"Current table name is ","messagePattern":"Current table name is ","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveTableUtils.java","lineNumber":38,"sourceCode":"import org.apache.seatunnel.api.configuration.ReadonlyConfig;\nimport org.apache.seatunnel.api.table.catalog.TablePath;\nimport org.apache.seatunnel.common.exception.CommonErrorCodeDeprecated;\nimport org.apache.seatunnel.common.exception.SeaTunnelRuntimeException;\nimport org.apache.seatunnel.connectors.seatunnel.file.config.FileFormat;\nimport org.apache.seatunnel.connectors.seatunnel.hive.config.HiveBaseOptions;\nimport org.apache.seatunnel.connectors.seatunnel.hive.config.HiveConstants;\nimport org.apache.seatunnel.connectors.seatunnel.hive.exception.HiveConnectorErrorCode;\nimport org.apache.seatunnel.connectors.seatunnel.hive.exception.HiveConnectorException;\n\nimport org.apache.hadoop.hive.metastore.api.Table;\n\npublic class HiveTableUtils {\n\n    public static Table getTableInfo(ReadonlyConfig readonlyConfig) {\n        String table = readonlyConfig.get(HiveBaseOptions.TABLE_NAME);\n        TablePath tablePath = TablePath.of(table);\n        if (tablePath.getDatabaseName() == null || tablePath.getTableName() == null) {\n            throw new SeaTunnelRuntimeException(\n                    HiveConnectorErrorCode.HIVE_TABLE_NAME_ERROR, \"Current table name is \" + table);\n        }\n        try (HiveMetaStoreProxy hiveMetaStoreProxy = new HiveMetaStoreProxy(readonlyConfig)) {\n            return hiveMetaStoreProxy.getTable(\n                    tablePath.getDatabaseName(), tablePath.getTableName());\n        }\n    }\n\n    public static FileFormat parseFileFormat(Table table) {\n        String inputFormat = table.getSd().getInputFormat();\n        if (HiveConstants.TEXT_INPUT_FORMAT_CLASSNAME.equals(inputFormat)) {\n            return FileFormat.TEXT;\n        }\n        if (HiveConstants.PARQUET_INPUT_FORMAT_CLASSNAME.equals(inputFormat)) {\n            return FileFormat.PARQUET;\n        }\n        if (HiveConstants.ORC_INPUT_FORMAT_CLASSNAME.equals(inputFormat)) {\n            return FileFormat.ORC;","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveTableUtils.java#L20-L56","documentation":"HiveTableUtils.getTableInfo parses the `table_name` config into a TablePath (database.table). The connector throws HIVE_TABLE_NAME_ERROR when either the database name or table name is missing, meaning the configured table name does not have the required `db.table` form. The connector cannot resolve the Hive metastore table without both parts.","triggerScenarios":"Calling HiveTableUtils.getTableInfo(readonlyConfig) where HiveBaseOptions.TABLE_NAME is null, a bare table name without a database prefix (e.g. \"mytable\"), or a malformed string like \"db.\" or \".table\" that yields a null databaseName or tableName from TablePath.of().","commonSituations":"User configures `table_name = \"my_table\"` instead of `\"my_db.my_table\"` in a Hive source/sink config; a placeholder template value was never substituted; extra/missing quotes or spaces around the value cause the split on '.' to fail.","solutions":["Set `table_name` to the fully qualified `database.table` form, e.g. `table_name = \"default.my_table\"`.","Check the HOCON config for typos, stray quotes, or an unrendered template variable in the table_name value.","If the value is built programmatically, validate it contains exactly one '.' with non-empty parts before calling getTableInfo."],"exampleFix":"// before\ntable_name = \"my_hive_table\"\n// after\ntable_name = \"default.my_hive_table\"","handlingStrategy":"validation","validationCode":"String table = readonlyConfig.get(HiveBaseOptions.TABLE_NAME);\nString[] parts = table == null ? new String[0] : table.split(\"\\\\.\");\nif (parts.length != 2 || parts[0].isEmpty() || parts[1].isEmpty()) {\n    throw new IllegalArgumentException(\"table_name must be 'database.table', got: \" + table);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Table t = HiveTableUtils.getTableInfo(readonlyConfig);\n} catch (SeaTunnelRuntimeException e) {\n    if (HiveConnectorErrorCode.HIVE_TABLE_NAME_ERROR.equals(e.getErrorCode())) {\n        // log config value and fail fast with guidance to use db.table\n    }\n    throw e;\n}","preventionTips":["Always write table_name as database.table in Hive connector configs.","Add a config pre-check in your deployment pipeline for the db.table pattern.","Render template variables before job submission and log the resolved value."],"tags":["hive","config","table-name"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}