@Override
public void runInternal() throws HiveSQLException {
setState(OperationState.RUNNING);
try {
IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient();
String schemaPattern = convertSchemaPattern(schemaName);
List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
if(isAuthV2Enabled()){
List<HivePrivilegeObject> privObjs = HivePrivilegeObjectUtils.getHivePrivDbObjects(matchingDbs);
String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName;
authorizeMetaGets(HiveOperationType.GET_TABLES, privObjs, cmdStr);
}
String tablePattern = convertIdentifierPattern(tableName, true);
for (TableMeta tableMeta :
metastoreClient.getTableMeta(schemaPattern, tablePattern, tableTypeList)) {
rowSet.addRow(new Object[] {
DEFAULT_HIVE_CATALOG,
tableMeta.getDbName(),
tableMeta.getTableName(),
tableTypeMapping.mapToClientType(tableMeta.getTableType()),
tableMeta.getComments(),
null, null, null, null, null
});
}
setState(OperationState.FINISHED);
} catch (Exception e) {
setState(OperationState.ERROR);
throw new HiveSQLException(e);
}
}