public class TableName extends Object implements Serializable
Constructor and Description |
---|
TableName(String catName,
String dbName,
String tableName) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static TableName |
fromString(String name,
String defaultCatalog,
String defaultDatabase)
Build a TableName from a string of the form [[catalog.]database.]table.
|
String |
getCat() |
String |
getDb() |
String |
getDbTable()
Deprecated.
use
getNotEmptyDbTable() instead. |
static String |
getDbTable(String dbName,
String tableName)
Get the name in db.table format, for use with stuff not yet converted to use the catalog.
|
String |
getEscapedNotEmptyDbTable()
Get the name in `db`.`table` escaped format, if db is not empty, otherwise pass only the table name.
|
String |
getNotEmptyDbTable()
Get the name in db.table format, if db is not empty, otherwise pass only the table name.
|
static String |
getQualified(String catName,
String dbName,
String tableName) |
String |
getTable() |
int |
hashCode() |
String |
toString() |
public TableName(String catName, String dbName, String tableName)
catName
- catalog name. Cannot be null. If you do not know it you can get it from
SessionState.getCurrentCatalog() if you want to use the catalog from the current
session, or from MetaStoreUtils.getDefaultCatalog() if you do not have a session
or want to use the default catalog for the Hive instance.dbName
- database name. Cannot be null. If you do not now it you can get it from
SessionState.getCurrentDatabase() or use Warehouse.DEFAULT_DATABASE_NAME.tableName
- table name, cannot be nullpublic static TableName fromString(String name, String defaultCatalog, String defaultDatabase) throws IllegalArgumentException
name
- name in string form, not nulldefaultCatalog
- default catalog to use if catalog is not in the name. If you do not
know it you can get it from SessionState.getCurrentCatalog() if you
want to use the catalog from the current session, or from
MetaStoreUtils.getDefaultCatalog() if you do not have a session or
want to use the default catalog for the Hive instance.defaultDatabase
- default database to use if database is not in the name. If you do
not now it you can get it from SessionState.getCurrentDatabase() or
use Warehouse.DEFAULT_DATABASE_NAME.IllegalArgumentException
- if a non-null name is givenpublic String getCat()
public String getDb()
public String getTable()
public String getDbTable()
getNotEmptyDbTable()
instead.public String getEscapedNotEmptyDbTable()
public String getNotEmptyDbTable()
public static String getDbTable(String dbName, String tableName)
Copyright © 2021 The Apache Software Foundation. All rights reserved.