You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "benj (JIRA)" <ji...@apache.org> on 2019/01/14 14:31:00 UTC

[jira] [Created] (DRILL-6975) TO_CHAR does not seems work well depends on LOCALE

benj created DRILL-6975:
---------------------------

             Summary: TO_CHAR does not seems work well depends on LOCALE
                 Key: DRILL-6975
                 URL: https://issues.apache.org/jira/browse/DRILL-6975
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
    Affects Versions: 1.15.0
            Reporter: benj


Strange results from TO_CHAR function when using different LOCALE.
{code:java}
SELECT TO_CHAR((CAST('2008-2-23' AS DATE)), 'yyyy-MMM-dd') FROM (VALUES(1));
2008-Feb-23 (in documentation (en_US.UTF-8)) 
2008-févr.-2 (fr_FR.UTF-8)
{code}
surprisingly by adding a space ('yyyy-MMM-dd ') (or any character) at the end of the format  the result becomes correct (so there is no problem when format a timestamp with 'yyyy MMM dd HH:mm:ss')
{code:java}
SELECT TO_CHAR(1256.789383, '#,###.###') FROM (VALUES(1));
1,256.789 (in documentation (en_US.UTF-8)) 
1 256,78 (fr_FR.UTF-8)
{code}
Even worse results can be achieved
{code:java}
SELECT TO_CHAR(12567,'#,###.###');
12,567 (en_US.UTF-8)
12 56 (fr_FR.UTF-8)
{code}
Again, with the add of a space/char at the end we get a better result.

I don't have tested all the locale, but for the last example, the result is right with de_DE.UTF-8 : 12.567

The situation is identical in 1.14

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)