[
https://issues.apache.org/jira/browse/DRILL-741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14017367#comment-14017367
]
Mehant Baid commented on DRILL-741:
-----------------------------------
We use Java's DecimalFormat to format the output of the to_char function,
please refer to that class to modify your format characters. An example would
be
select to_char(1234, '##,##') from dfs.`/tmp/input.json`;
+------------+
| EXPR$0 |
+------------+
| 12,34 |
+------------+
> TO_CHAR function is not returning expected results
> --------------------------------------------------
>
> Key: DRILL-741
> URL: https://issues.apache.org/jira/browse/DRILL-741
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Reporter: Krystal
> Assignee: Krystal
>
> Some to_char functions from drill are not returning expected result. Below
> are the examples:
> select to_char(485.8, '"Pre:"999" Post:" .999') from voter where voter_id=10;
> drill: "Pre:"999" Post:" 486.999
> expected: Pre: 485 Post: .800
> select to_char(1234.6789,'9999999D99999') from voter where voter_id=10;
> drill: 9999999D999991235
> expected: 1234.67890
> select to_char(123456789, '999G999G999D99') from voter where voter_id=10;
> drill: 999G999G999D99123456789
> expected: 123,456,789.00
> select to_char(-485, '999PR') from voter where voter_id=10;
> drill: -999PR485
> expected: <485>
> select to_char(0.0004859, '9.99EEEE') from voter where voter_id=10;
> drill: 90.99EEEE
> expected: 4.86e-04
> select to_char(485, '9 9 9') from voter where voter_id=10;
> drill: 9 9 9485
> expected: 4 8 5
--
This message was sent by Atlassian JIRA
(v6.2#6252)