pan3793 commented on code in PR #36418:
URL: https://github.com/apache/spark/pull/36418#discussion_r869904900


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/Catalogs.scala:
##########
@@ -45,7 +45,11 @@ private[sql] object Catalogs {
   @throws[SparkException]
   def load(name: String, conf: SQLConf): CatalogPlugin = {
     val pluginClassName = try {
-      conf.getConfString("spark.sql.catalog." + name)
+      val _pluginClassName = conf.getConfString(s"spark.sql.catalog.$name")
+      if (name.contains(".")) {

Review Comment:
   Then we need a specific exception class for that case like 
`InvalidCatalogNameException`, and catch it as well as   
`CatalogNotFoundException` in`CatalogManager` and `LookupCatalog`, otherwise 
may casue failure in analyze phase
   ```
   - run sql directly on files *** FAILED *** (369 milliseconds)
   [info]   org.apache.spark.SparkException: Invalid catalog name: 
org.apache.spark.sql.json
   [info]   at 
org.apache.spark.sql.errors.QueryExecutionErrors$.invalidCatalogNameError(QueryExecutionErrors.scala:1538)
   [info]   at 
org.apache.spark.sql.connector.catalog.Catalogs$.load(Catalogs.scala:47)
   [info]   at 
org.apache.spark.sql.connector.catalog.CatalogManager.$anonfun$catalog$1(CatalogManager.scala:54)
   [info]   at 
scala.collection.mutable.HashMap.getOrElseUpdate(HashMap.scala:86)
   [info]   at 
org.apache.spark.sql.connector.catalog.CatalogManager.catalog(CatalogManager.scala:54)
   [info]   at 
org.apache.spark.sql.connector.catalog.LookupCatalog$CatalogAndIdentifier$.unapply(LookupCatalog.scala:122)
   [info]   at 
org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveRelations$.$anonfun$lookupRelation$1(Analyzer.scala:1199)
   ```
   Do you think it's a right direction?
   



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

To unsubscribe, e-mail: [email protected]

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