Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2034

FileReaderTest fails with path containing spaces

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.15.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When a path has spaces in it, the FileReaderTest.java test fails with the error:

      {{
      Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
      Running org.apache.calcite.adapter.file.FileReaderTest
      directory /home/jenkins/jenkins-slave/workspace/Calcite-Master/jdk/JDK%201.8%20(latest)/file/target/test-classes/sales-csv not found
      Tests run: 13, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 3.364 sec <<< FAILURE! - in org.apache.calcite.adapter.file.FileReaderTest
      testCsvFile(org.apache.calcite.adapter.file.FileReaderTest) Time elapsed: 0.027 sec <<< ERROR!
      java.sql.SQLException: Error while executing SQL "select * from FILES.DEPTS": From line 1, column 15 to line 1, column 25: Object 'DEPTS' not found within 'FILES'
      at org.apache.calcite.adapter.file.FileReaderTest.testCsvFile(FileReaderTest.java:228)
      Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 15 to line 1, column 25: Object 'DEPTS' not found within 'FILES'
      at org.apache.calcite.adapter.file.FileReaderTest.testCsvFile(FileReaderTest.java:228)
      Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Object 'DEPTS' not found within 'FILES'
      at org.apache.calcite.adapter.file.FileReaderTest.testCsvFile(FileReaderTest.java:228)
      }}

      This can cause the Jenkins build to fail (e.g.:
      https://builds.apache.org/job/Calcite-Master/jdk=JDK%201.8%20(latest)/131/console).

      The offending method is FileReaderTest.resourcePath, which creates a oath reference from URL.toString, but toString percent-encodes space characters. When it is subsequently turned into a file, it isn't found.

      A solution might be to create the file reference with new File(url.toURI()).

        Activity

        Hide
        michaelmior Michael Mior added a comment -

        LGTM. Thanks Marc! Fixed in c25f7c937.

        Show
        michaelmior Michael Mior added a comment - LGTM. Thanks Marc! Fixed in c25f7c937 .
        Hide
        mprudhom Marc Prud'hommeaux added a comment -
        Show
        mprudhom Marc Prud'hommeaux added a comment - This should be fixed with https://github.com/apache/calcite/pull/559

          People

          • Assignee:
            michaelmior Michael Mior
            Reporter:
            mprudhom Marc Prud'hommeaux
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development