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



##########
File path: spark3/src/main/java/org/apache/iceberg/spark/SparkCatalog.java
##########
@@ -453,4 +467,21 @@ private static void commitChanges(Table table, SetProperty 
setLocation, SetPrope
 
     transaction.commitTransaction();
   }
+
+  private static boolean isPathIdentifier(Identifier ident) {
+    return ident instanceof PathIdentifier;
+  }
+
+  private static void checkNotPathIdentifier(Identifier identifier, String 
method) {
+    if (identifier instanceof PathIdentifier) {
+      throw new IllegalArgumentException(String.format("Cannot pass path based 
identifier to %s method. %s is a path.",
+          method, identifier));
+    }
+  }
+
+  private <T> T pathOrTable(Identifier ident, Function<String, T> path, 
Function<TableIdentifier, T> table) {

Review comment:
       Looks like there are 3 ways this is called:
   1. To load a table
   2. To create a builder
   3. To drop a table
   
   I think it would be a bit cleaner to make the first 2 into private methods 
(`load` and `newBuilder`) rather than using `pathOrTable` with the same 
functions in lots of places.




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