maropu commented on a change in pull request #25399: [SPARK-28670][SQL] create 
function should thrown Exception if the resource is not found
URL: https://github.com/apache/spark/pull/25399#discussion_r312689938
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/functions.scala
 ##########
 @@ -88,6 +98,7 @@ case class CreateFunctionCommand(
         // For a permanent, we will store the metadata into underlying 
external catalog.
         // This function will be loaded into the FunctionRegistry when a query 
uses it.
         // We do not load it into FunctionRegistry right now.
+        checkIfResourceExists
 
 Review comment:
   How about this?
   ```
           // Checks if the given resources exist
           val hadoopConf = sparkSession.sparkContext.hadoopConfiguration
           val nonExistentResources = resources.filter { r =>
             val path = new Path(r.uri)
             !path.getFileSystem(hadoopConf).exists(path)
           }
           if (nonExistentResources.nonEmpty) {
             throw new AnalysisException(s"Resources not found: 
${nonExistentResources.mkString(",")}")
           }
   ```
   btw, this check should be placed in the start of  
`CreateFunctionCommand.run`?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to