tajo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seungun Choe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAJO-637) Enhance to_char() function
Date Tue, 22 Apr 2014 08:53:17 GMT

    [ https://issues.apache.org/jira/browse/TAJO-637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13976558#comment-13976558
] 

Seungun Choe commented on TAJO-637:
-----------------------------------

In my patch~! There are some bug.
{code}
 ex ) select to_char(123.12345, '9999999.999999999')  --> "    123.123450000" is correct
result.
        But, this query's reult is "    123.147483647".
{code}

In my source,
{code}
      if(tmpNum > 0)
        roundNum = (int)(tmpNum * Math.pow(10, dotUnderPttnLen) + (double)0.5) / Math.pow(10,
dotUnderPttnLen);
      else
        roundNum = (int)(tmpNum * Math.pow(10, dotUnderPttnLen) - (double)0.5) / Math.pow(10,
dotUnderPttnLen);
      String strRoundNum = String.valueOf(roundNum);
  // tmpNum is user input parameter no.1.
{code}

At pattern "999.9999999999",
dot under number 9's count is smaller than 7, it's no problem.
But bigger than 8, showed problem.

How to slove this problem?

> Enhance to_char() function
> --------------------------
>
>                 Key: TAJO-637
>                 URL: https://issues.apache.org/jira/browse/TAJO-637
>             Project: Tajo
>          Issue Type: Improvement
>    Affects Versions: 0.8
>            Reporter: Keuntae Park
>            Assignee: Seungun Choe
>            Priority: Minor
>              Labels: patch
>         Attachments: TAJO-637.patch, TAJO-637_1.patch
>
>
> Currently, Tajo only supports to_char(timestamp, text) function.
> However, PostgreSQL supports to_char() for timestamp, interval, int, double, and numeric
types
> Tajo needs to support more data types in to_char() as shown in 
> http://www.postgresql.org/docs/9.3/static/functions-formatting.html



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message