Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-4225

TestDateFunctions#testToChar fails when the locale is non-English

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.0
    • 1.6.0
    • Execution - Data Types
    • None
    • Mac OS X 10.10.5

    Description

      Set the locale to ja_JP on Mac OS X:

      $ defaults read -g AppleLocale
      ja_JP
      

      TestDateFunctions#testToChar fails with the following output:

      Running org.apache.drill.exec.fn.impl.TestDateFunctions#testToChar
      2008-2-23
      12 20 30
      2008 2 23 12:00:00
      
      ...
      
      Tests run: 6, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 14.333 sec <<< FAILURE! - in org.apache.drill.exec.fn.impl.TestDateFunctions
      testToChar(org.apache.drill.exec.fn.impl.TestDateFunctions)  Time elapsed: 2.793 sec  <<< FAILURE!
      org.junit.ComparisonFailure: expected:<2008-[Feb]-23> but was:<2008-[2]-23>
      	at org.apache.drill.exec.fn.impl.TestDateFunctions.testCommon(TestDateFunctions.java:66)
      	at org.apache.drill.exec.fn.impl.TestDateFunctions.testToChar(TestDateFunctions.java:139)
      
      ...
      
      Failed tests: 
        TestDateFunctions.testToChar:139->testCommon:66 expected:<2008-[Feb]-23> but was:<2008-[2]-23>
      

      Test queries are like this:

      to_char((cast('2008-2-23' as date)), 'yyyy-MMM-dd')
      to_char(cast('12:20:30' as time), 'HH mm ss')
      to_char(cast('2008-2-23 12:00:00' as timestamp), 'yyyy MMM dd HH:mm:ss')
      

      This failure occurs because org.joda.time.format.DateTimeFormat interprets the pattern 'MMM' differently depending on the locale. This will probably occur in other OS platforms.

      Attachments

        Activity

          People

            Unassigned Unassigned
            nagix Akihiko Kusanagi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: