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

Gunther Hagleitner commented on HIVE-3820:
------------------------------------------

In the integer world we have literals for all int types except integer itself 
(which is the default int type). Double/float could follow the same model: 
Double is the default, little need to have a special literal, but for float it 
makes sense to me. 

Decimal is a special case - since numeric values default to double a literal is 
necessary to separate from that type.

Glad you pointed HIVE-2586 out, it does validate Ashutosh' thinking and makes 
another case for BD instead of D.
                
> Consider creating a literal like "D" or "BD" for representing Decimal type 
> constants
> ------------------------------------------------------------------------------------
>
>                 Key: HIVE-3820
>                 URL: https://issues.apache.org/jira/browse/HIVE-3820
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Mark Grover
>            Assignee: Gunther Hagleitner
>         Attachments: HIVE-3820.1.patch, HIVE-3820.2.patch, 
> HIVE-3820.D8823.1.patch
>
>
> When the HIVE-2693 gets committed, users are going to see this behavior:
> {code}
> hive> select cast(3.14 as decimal) from decimal_3 limit 1;
> 3.140000000000000124344978758017532527446746826171875
> {code}
> That's intuitively incorrect but is the case because 3.14 (double) is being 
> converted to BigDecimal because of which there is a precision mismatch.
> We should consider creating a new literal for expressing constants of Decimal 
> type as Gunther suggested in HIVE-2693.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to