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_r271930881
##########
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:
I am ok about `e` instead of `e.getCause()`, but in both cases it is the
last argument for `warn` method. So not sure what is the difference will a
String formatting approach. However WARN level is used by default, users will
not have benefit from placeholders. And this is not important. So you can keep
your approach here.
----------------------------------------------------------------
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