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

FileReaderTest fails with path containing spaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.15.0
    • 1.16.0
    • None
    • 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()).

      Attachments

        Activity

          People

            mmior Michael Mior
            mprudhom Marc Prud'hommeaux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: