You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Ted Dunning (JIRA)" <ji...@apache.org> on 2015/03/30 18:29:53 UTC

[jira] [Commented] (DRILL-2620) Casting to float is changing the value slightly

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

Ted Dunning commented on DRILL-2620:
------------------------------------

What did you expect to see?

In SQL the default precision of a FLOAT is implementation defined.  I strongly suspect that in Drill the default is 24 (i.e. single precision).  If you care (and you seem to), you might be better served by specifying DOUBLE as the type or FLOAT(53).

Single precision floating point (aka float) only provides 6 digits of precision.  You, as the lucky person you are, got 7.

http://en.wikipedia.org/wiki/Single-precision_floating-point_format

> Casting to float is changing the value slightly
> -----------------------------------------------
>
>                 Key: DRILL-2620
>                 URL: https://issues.apache.org/jira/browse/DRILL-2620
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>            Reporter: Rahul Challapalli
>            Assignee: Daniel Barclay (Drill)
>
> git.commit.id.abbrev=c11fcf7
> Data Set :
> {code}
> 2345552345.5342
> 4784.5735
> {code}
> Drill Query :
> {code}
> select cast(columns[0] as float) from `abc.tbl`;
> +------------+
> |   EXPR$0   |
> +------------+
> | 2.34555238E9 |
> | 4784.5737  |
> +------------+
> {code}
> I am not sure whether this is a known limitation or a bug



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)