public abstract class AbstractDBStore extends CatalogConstants implements CatalogStore
Modifier and Type | Field and Description |
---|---|
protected Map<String,Boolean> |
baseTableMaps |
protected String |
catalogUri |
protected org.apache.hadoop.conf.Configuration |
conf |
protected String |
connectionId |
protected String |
connectionPassword |
protected org.apache.commons.logging.Log |
LOG |
CATALOG_URI, COL_DATABASES_PK, COL_TABLES_NAME, COL_TABLES_PK, COL_TABLESPACE_PK, CONNECTION_ID, CONNECTION_PASSWORD, DEPRECATED_CATALOG_URI, DEPRECATED_CONNECTION_ID, DEPRECATED_CONNECTION_PASSWORD, IDENTIFIER_DELIMITER, IDENTIFIER_DELIMITER_REGEXP, IDENTIFIER_QUOTE_STRING, MAX_IDENTIFIER_LENGTH, MAX_USERNAME_LENGTH, STORE_CLASS, TB_COLUMNS, TB_DATABASES, TB_INDEXES, TB_META, TB_OPTIONS, TB_PARTITION_METHODS, TB_PARTTIONS, TB_SPACES, TB_STATISTICS, TB_TABLES
Constructor and Description |
---|
AbstractDBStore(org.apache.hadoop.conf.Configuration conf) |
protected final org.apache.commons.logging.Log LOG
protected final org.apache.hadoop.conf.Configuration conf
protected final String connectionId
protected final String connectionPassword
protected final String catalogUri
public AbstractDBStore(org.apache.hadoop.conf.Configuration conf) throws InternalException
InternalException
protected abstract String getCatalogDriverName()
protected abstract Connection createConnection(org.apache.hadoop.conf.Configuration conf) throws SQLException
SQLException
protected abstract boolean isInitialized() throws CatalogException
CatalogException
protected abstract void createBaseTable() throws CatalogException
CatalogException
protected abstract void dropBaseTable() throws CatalogException
CatalogException
public abstract int getDriverVersion()
public String readSchemaFile(String path) throws CatalogException
CatalogException
protected String getCatalogUri()
public Connection getConnection()
protected void insertSchemaVersion() throws CatalogException
CatalogException
public void createTablespace(String spaceName, String spaceUri) throws CatalogException
CatalogStore
createTablespace
in interface CatalogStore
CatalogException
public boolean existTablespace(String tableSpaceName) throws CatalogException
existTablespace
in interface CatalogStore
CatalogException
public void dropTablespace(String tableSpaceName) throws CatalogException
dropTablespace
in interface CatalogStore
CatalogException
public Collection<String> getAllTablespaceNames() throws CatalogException
getAllTablespaceNames
in interface CatalogStore
CatalogException
public CatalogProtos.TablespaceProto getTablespace(String spaceName) throws CatalogException
getTablespace
in interface CatalogStore
CatalogException
public void alterTablespace(CatalogProtos.AlterTablespaceProto alterProto) throws CatalogException
alterTablespace
in interface CatalogStore
CatalogException
public void createDatabase(String databaseName, String tablespaceName) throws CatalogException
CatalogStore
createDatabase
in interface CatalogStore
CatalogException
public boolean existDatabase(String databaseName) throws CatalogException
existDatabase
in interface CatalogStore
CatalogException
public void dropDatabase(String databaseName) throws CatalogException
dropDatabase
in interface CatalogStore
CatalogException
public Collection<String> getAllDatabaseNames() throws CatalogException
getAllDatabaseNames
in interface CatalogStore
CatalogException
public void createTable(CatalogProtos.TableDescProto table) throws CatalogException
CatalogStore
createTable
in interface CatalogStore
CatalogException
public void alterTable(CatalogProtos.AlterTableDescProto alterTableDescProto) throws CatalogException
alterTable
in interface CatalogStore
CatalogException
public boolean existTable(String databaseName, String tableName) throws CatalogException
existTable
in interface CatalogStore
CatalogException
public void dropTableInternal(Connection conn, String databaseName, String tableName) throws SQLException
SQLException
public void dropTable(String databaseName, String tableName) throws CatalogException
dropTable
in interface CatalogStore
CatalogException
public Pair<Integer,String> getDatabaseIdAndUri(String databaseName) throws SQLException
SQLException
public CatalogProtos.TableDescProto getTable(String databaseName, String tableName) throws CatalogException
getTable
in interface CatalogStore
CatalogException
public List<String> getAllTableNames(String databaseName) throws CatalogException
getAllTableNames
in interface CatalogStore
CatalogException
public void addPartitions(CatalogProtos.PartitionsProto partitionsProto) throws CatalogException
CatalogStore
addPartitions
in interface CatalogStore
CatalogException
public void addPartitionMethod(CatalogProtos.PartitionMethodProto proto) throws CatalogException
CatalogStore
addPartitionMethod
in interface CatalogStore
CatalogException
public void dropPartitionMethod(String databaseName, String tableName) throws CatalogException
dropPartitionMethod
in interface CatalogStore
CatalogException
public CatalogProtos.PartitionMethodProto getPartitionMethod(String databaseName, String tableName) throws CatalogException
getPartitionMethod
in interface CatalogStore
CatalogException
public boolean existPartitionMethod(String databaseName, String tableName) throws CatalogException
existPartitionMethod
in interface CatalogStore
CatalogException
public void addPartition(String databaseName, String tableName, CatalogProtos.PartitionDescProto partition) throws CatalogException
addPartition
in interface CatalogStore
CatalogException
public CatalogProtos.PartitionDescProto getPartition(String partitionName) throws CatalogException
getPartition
in interface CatalogStore
CatalogException
public CatalogProtos.PartitionsProto getPartitions(String tableName) throws CatalogException
CatalogStore
getPartitions
in interface CatalogStore
tableName
- the table nameCatalogException
public void delPartition(String partitionName) throws CatalogException
delPartition
in interface CatalogStore
CatalogException
public void dropPartitions(String tableName) throws CatalogException
dropPartitions
in interface CatalogStore
CatalogException
public void createIndex(CatalogProtos.IndexDescProto proto) throws CatalogException
CatalogStore
createIndex
in interface CatalogStore
CatalogException
public void dropIndex(String databaseName, String indexName) throws CatalogException
dropIndex
in interface CatalogStore
CatalogException
public static String getTableName(Connection conn, int tableId) throws SQLException
SQLException
public CatalogProtos.IndexDescProto getIndexByName(String databaseName, String indexName) throws CatalogException
getIndexByName
in interface CatalogStore
CatalogException
public CatalogProtos.IndexDescProto getIndexByColumn(String databaseName, String tableName, String columnName) throws CatalogException
getIndexByColumn
in interface CatalogStore
CatalogException
public boolean existIndexByName(String databaseName, String indexName) throws CatalogException
existIndexByName
in interface CatalogStore
CatalogException
public boolean existIndexByColumn(String databaseName, String tableName, String columnName) throws CatalogException
existIndexByColumn
in interface CatalogStore
CatalogException
public CatalogProtos.IndexDescProto[] getIndexes(String databaseName, String tableName) throws CatalogException
getIndexes
in interface CatalogStore
CatalogException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public final void addFunction(FunctionDesc func) throws CatalogException
CatalogStore
addFunction
in interface CatalogStore
CatalogException
public final void deleteFunction(FunctionDesc func) throws CatalogException
deleteFunction
in interface CatalogStore
CatalogException
public final void existFunction(FunctionDesc func) throws CatalogException
existFunction
in interface CatalogStore
CatalogException
public final List<String> getAllFunctionNames() throws CatalogException
getAllFunctionNames
in interface CatalogStore
CatalogException
Copyright © 2014 Apache Software Foundation. All Rights Reserved.