PHOENIX-3652 Users who do not have global access to hbase cluster can't connect to phoenix
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 7a9f0e5..2916c44 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2734,9 +2734,8 @@
HTableInterface metatable = null;
try (HBaseAdmin admin = getAdmin()) {
ensureNamespaceCreated(QueryConstants.SYSTEM_SCHEMA_NAME);
- List<HTableDescriptor> tables = Arrays
- .asList(admin.listTables(QueryConstants.SYSTEM_SCHEMA_NAME + "\\..*"));
- List<String> tableNames = getTableNames(tables);
+ List<TableName> tableNames = Arrays
+ .asList(admin.listTableNames(QueryConstants.SYSTEM_SCHEMA_NAME + "\\..*"));
if (tableNames.size() == 0) { return; }
if (tableNames.size() > 4) { throw new IllegalArgumentException(
"Expected 4 system table only but found " + tableNames.size() + ":" + tableNames); }
@@ -2754,10 +2753,10 @@
}
tableNames.remove(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
}
- for (String table : tableNames) {
- UpgradeUtil.mapTableToNamespace(admin, metatable, table, props, null, PTableType.SYSTEM,
+ for (TableName table : tableNames) {
+ UpgradeUtil.mapTableToNamespace(admin, metatable, table.getNameAsString(), props, null, PTableType.SYSTEM,
null);
- ConnectionQueryServicesImpl.this.removeTable(null, table, null,
+ ConnectionQueryServicesImpl.this.removeTable(null, table.getNameAsString(), null,
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0);
}
if (!tableNames.isEmpty()) {
@@ -2845,14 +2844,6 @@
}
}
- private List<String> getTableNames(List<HTableDescriptor> tables) {
- List<String> tableNames = new ArrayList<String>(4);
- for (HTableDescriptor desc : tables) {
- tableNames.add(desc.getNameAsString());
- }
- return tableNames;
- }
-
private String addColumn(String columnsToAddSoFar, String columns) {
if (columnsToAddSoFar == null || columnsToAddSoFar.isEmpty()) {
return columns;