vdiravka commented on a change in pull request #1706: DRILL-7115: Improve Hive 
schema show tables performance
URL: https://github.com/apache/drill/pull/1706#discussion_r271179071
 
 

 ##########
 File path: 
contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveDatabaseSchema.java
 ##########
 @@ -63,89 +58,38 @@ public Table getTable(String tableName) {
     return hiveSchema.getDrillTable(this.name, tableName);
   }
 
+  @Override
+  public Collection<Map.Entry<String, TableType>> getTableNamesAndTypes() {
+    ensureInitTables();
+    return tables.entrySet();
+  }
+
   @Override
   public Set<String> getTableNames() {
+    ensureInitTables();
+    return tables.keySet();
+  }
+
+  private void ensureInitTables() {
     if (tables == null) {
       try {
-        tables = Sets.newHashSet(mClient.getTableNames(this.name, 
schemaConfig.getIgnoreAuthErrors()));
-      } catch (final TException e) {
-        logger.warn("Failure while attempting to access HiveDatabase '{}'.", 
this.name, e.getCause());
-        tables = Sets.newHashSet(); // empty set.
+        tables = mClient.getTableNamesAndTypes(this.name, 
schemaConfig.getIgnoreAuthErrors());
+      } catch (TException e) {
+        logger.warn(String.format(
 
 Review comment:
   Why `String.format`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to