diff --git a/service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java b/service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java index 5ccdc94773..34c1f0c241 100644 --- a/service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java +++ b/service/src/java/org/apache/hive/service/cli/operation/GetTablesOperation.java @@ -113,9 +113,13 @@ public void runInternal() throws HiveSQLException { } String tablePattern = convertIdentifierPattern(tableName, true); + StringBuilder authorizedDbs = new StringBuilder(); for (String dbName : metastoreClient.getDatabases(schemaPattern)) { + authorizedDbs.append(dbName).append("|"); + } + String dbNamePattern = convertIdentifierPattern(authorizedDbs.toString(), true); for (TableMeta tableMeta : - metastoreClient.getTableMeta(dbName, tablePattern, tableTypeList)) { + metastoreClient.getTableMeta(dbNamePattern, tablePattern, tableTypeList)) { String tableType = tableTypeMapping.mapToClientType(tableMeta.getTableType()); rowSet.addRow(new Object[]{ DEFAULT_HIVE_CATALOG, @@ -135,7 +139,7 @@ public void runInternal() throws HiveSQLException { if (LOG.isDebugEnabled() && rowSet.numRows() == 0) { LOG.debug("No table metadata has been returned."); } - } + setState(OperationState.FINISHED); LOG.info("Fetching table metadata has been successfully finished"); } catch (Exception e) {