Github user windpiger commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17338#discussion_r106777091
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -700,20 +701,33 @@ abstract class DDLSuite extends QueryTest with 
SQLTestUtils {
     
       test("create temporary view using") {
         val csvFile =
    -      
Thread.currentThread().getContextClassLoader.getResource("test-data/cars.csv").toString
    -    withView("testview") {
    -      sql(s"CREATE OR REPLACE TEMPORARY VIEW testview (c1 String, c2 
String)  USING " +
    -        "org.apache.spark.sql.execution.datasources.csv.CSVFileFormat  " +
    -        s"OPTIONS (PATH '$csvFile')")
    +      
Thread.currentThread().getContextClassLoader.getResourceAsStream("test-data/cars.csv")
    --- End diff --
    
    the point is that the return value of `getResource.toString` is 
'jar:file:/xxx.jar!/test-data/cars.csv'.If we use this path to set table 
location as following code in the test case, this path will cause exception 
when it is used to construct `new Path()` in 
[here](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala#L344).
    
    So I copy this file from resource in jar to a temp file, which path is 
'file:/tmppath/cars.csv', and use this normal path to set table location ,it is 
ok for the following code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to