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



##########
File path: 
spark3/src/main/java/org/apache/iceberg/spark/procedures/BaseProcedure.java
##########
@@ -74,26 +71,20 @@ protected BaseProcedure(TableCatalog tableCatalog) {
     return result;
   }
 
-  // we have to parse both namespace and name as they may be quoted
-  protected Identifier toIdentifier(String namespaceAsString, String name) {
-    String[] namespaceParts = parseMultipartIdentifier(namespaceAsString);
-
-    String[] nameParts = parseMultipartIdentifier(name);
-    Preconditions.checkArgument(nameParts.length == 1, "Name must consist of 
one part: %s", name);
-
-    return Identifier.of(namespaceParts, nameParts[0]);
-  }
-
-  private String[] parseMultipartIdentifier(String identifierAsString) {
+  private Identifier toIdentifier(String identifierAsString) {
+    CatalogAndIdentifier catalogAndIdentifier;
     try {
-      ParserInterface parser = spark.sessionState().sqlParser();
-      Seq<String> namePartsSeq = 
parser.parseMultipartIdentifier(identifierAsString);
-      String[] nameParts = new String[namePartsSeq.size()];
-      namePartsSeq.copyToArray(nameParts);
-      return nameParts;
+      catalogAndIdentifier = Spark3Util.catalogAndIdentifier(spark, 
identifierAsString, tableCatalog);
     } catch (ParseException e) {
-      throw new RuntimeException("Couldn't parse identifier: " + 
identifierAsString, e);
+      throw new IllegalArgumentException("Cannot parse identifier", e);

Review comment:
       It would be nice to follow this recommendation from the other review: 
https://github.com/apache/iceberg/pull/1525/files#r538758721
   
   The description could be the argument name.




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