RussellSpitzer commented on a change in pull request #1890:
URL: https://github.com/apache/iceberg/pull/1890#discussion_r538767352



##########
File path: spark3/src/main/java/org/apache/iceberg/spark/Spark3Util.java
##########
@@ -605,31 +605,41 @@ private static String 
sqlString(org.apache.iceberg.expressions.Literal<?> lit) {
   }
 
   public static CatalogAndIdentifier catalogAndIdentifier(SparkSession spark, 
String name) throws ParseException {
+    return catalogAndIdentifier(spark, name, 
spark.sessionState().catalogManager().currentCatalog());
+  }
+
+  public static CatalogAndIdentifier catalogAndIdentifier(SparkSession spark, 
String name,
+                                                          CatalogPlugin 
defaultCatalog) throws ParseException {
     ParserInterface parser = spark.sessionState().sqlParser();
     Seq<String> multiPartIdentifier = parser.parseMultipartIdentifier(name);
     List<String> javaMultiPartIdentifier = 
JavaConverters.seqAsJavaList(multiPartIdentifier);
-    return catalogAndIdentifier(spark, javaMultiPartIdentifier);
+    return catalogAndIdentifier(spark, javaMultiPartIdentifier, 
defaultCatalog);
+  }
+
+  public static CatalogAndIdentifier catalogAndIdentifier(SparkSession spark, 
List<String> nameParts) {
+    return catalogAndIdentifier(spark, nameParts, 
spark.sessionState().catalogManager().currentCatalog());
   }
 
   /**
    * A modified version of Spark's LookupCatalog.CatalogAndIdentifier.unapply
    * Attempts to find the catalog and identifier a multipart identifier 
represents
    * @param spark Spark session to use for resolution
    * @param nameParts Multipart identifier representing a table
+   * @param fallBackCatalog Catalog to use if none is specified
    * @return The CatalogPlugin and Identifier for the table
    */
-  public static CatalogAndIdentifier catalogAndIdentifier(SparkSession spark, 
List<String> nameParts) {
+  public static CatalogAndIdentifier catalogAndIdentifier(SparkSession spark, 
List<String> nameParts,
+                                                          CatalogPlugin 
fallBackCatalog) {
     Preconditions.checkArgument(!nameParts.isEmpty(),
         "Cannot determine catalog and Identifier from empty name parts");
     CatalogManager catalogManager = spark.sessionState().catalogManager();
-    CatalogPlugin currentCatalog = catalogManager.currentCatalog();
     String[] currentNamespace = catalogManager.currentNamespace();

Review comment:
       Yeah I was wondering a bit about this, I think that's a reasonable solve




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