HyukjinKwon 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_r366115660
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/functions.scala
##########
@@ -74,6 +76,15 @@ case class CreateFunctionCommand(
}
override def run(sparkSession: SparkSession): Seq[Row] = {
+ // Checks if the given resources exist
+ val hadoopConf = sparkSession.sparkContext.hadoopConfiguration
+ val nonExistentResources = resources.filter { r =>
+ val path = new Path(r.uri)
Review comment:
it will also break one case with local schema
```
scala> new
Path("local:/path").getFileSystem(spark.sparkContext.hadoopConfiguration)
java.io.IOException: No FileSystem for scheme: local
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2660)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2667)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:94)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2703)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2685)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:295)
... 47 elided
```
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/SparkContext.scala#L1903
I think I rushed to review this one. Reverting this.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]