rdblue commented on a change in pull request #1394:
URL: https://github.com/apache/iceberg/pull/1394#discussion_r478760991



##########
File path: mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
##########
@@ -65,13 +68,17 @@ public static Table loadTable(Configuration conf, 
Properties props) {
   private static Table loadTable(Configuration conf, String tableIdentifier, 
String tableLocation) {
     Optional<Catalog> catalog = loadCatalog(conf);
 
+    Table table;
     if (catalog.isPresent()) {
       Preconditions.checkArgument(tableIdentifier != null, "Table identifier 
not set");
-      return catalog.get().loadTable(TableIdentifier.parse(tableIdentifier));
+      table = catalog.get().loadTable(TableIdentifier.parse(tableIdentifier));
+    } else {
+      Preconditions.checkArgument(tableLocation != null, "Table location not 
set");
+      table = new HadoopTables(conf).load(tableLocation);
     }
 
-    Preconditions.checkArgument(tableLocation != null, "Table location not 
set");
-    return new HadoopTables(conf).load(tableLocation);
+    LOG.info("Table loaded by catalog: [{}]", table);

Review comment:
       I think this should be done in the catalog or `HadoopTables`, not in 
`Catalogs`. Otherwise, we don't get the log message consistently when table 
loads go directly through the catalog (as in Spark 3) or through a different 
class like IcebergSource (Spark 2). And if we were to later add a message to 
the catalog, then this would be a duplicate.

##########
File path: mr/src/main/java/org/apache/iceberg/mr/Catalogs.java
##########
@@ -83,28 +90,33 @@ private static Table loadTable(Configuration conf, String 
tableIdentifier, Strin
               .impl(catalogLoaderClass)
               .build()
               .newInstance();
-      return Optional.of(loader.load(conf));
+      Catalog catalog = loader.load(conf);
+      LOG.info("Dynamic catalog is used: [{}]", catalog);

Review comment:
       I think it would be better to give more specific information:
   
   ```java
   LOG.info("Loaded catalog {} using {}", catalog, catalogLoaderClass);
   ```




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to