Github user avulanov commented on a diff in the pull request:
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala ---
    @@ -757,7 +758,10 @@ private[sql] class SQLConf extends Serializable with 
CatalystConf with Logging {
       def variableSubstituteDepth: Int = getConf(VARIABLE_SUBSTITUTE_DEPTH)
    -  def warehousePath: String = new Path(getConf(WAREHOUSE_PATH)).toString
    +  def warehousePath: String = {
    +    val path = new Path(getConf(WAREHOUSE_PATH))
    +    FileSystem.get(path.toUri, new 
    --- End diff --
    `resolveURI` tries to use `new URI`, encounters a `URISyntaxException` due 
to the white space symbol and falls back to: `new 
File(path).getAbsoluteFile().toURI()`. The latter does not deal with schema. 
This is why the first example looks weird:
    scala> resolveURI("file:///C:/My Programs/path")
    (Spark)res28: = 
    (Scala) res1: = 
    -----no space----
    scala> resolveURI("file:///C:/MyPrograms/path")
    (Spark) = file:///C:/MyPrograms/path
    (Scala) = file:///C:/MyPrograms/path
    Second example is OK.
    Third example works fine with white space on Windows (adds home on Linux) 
but breaks without it:
    scala> resolveURI("C:/My Programs/path")
    res41: = file:/C:/My%20Programs/path
    ----no space---
    scala> resolveURI("C:/MyPrograms/path")
    res42: = C:/MyPrograms/path
    Fourth works fine both with both. There is one more subtle thing, the 
letter drive becomes lower case in Spark.
    scala>  resolveURI("/My Programs/path")
    (Spark)res31: = file:/c:/My%20Programs/path
    (Scala) res4: = file:/C:/My%20Programs/path
    A character in the string should not be a reason to execute a particular 
branch of code. We should rather check the schema and work from this.

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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to