[
https://issues.apache.org/jira/browse/HIVE-2693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13535519#comment-13535519
]
Gunther Hagleitner commented on HIVE-2693:
------------------------------------------
Ok. I think I've convinced myself that the cast statement above is executed
correctly, but the result is definitely not very intuitive.
When you say: "cast (3.14 as decimal)" you ask hive to convert the double 3.14
to a bigdecimal in unlimited context, i.e. no rounding. Thus 3.1400001234... is
correct. If you ask "cast('3.14' as decimal)" you get 3.14. Which is what you
want. Rounding would be another option.
There was a similar issue with big integer: HIVE-2509. They 'solved' the
problem by at least having a shorthand for big int literals (i.e.: 0L).
BigDecimal should at the very least allow something like that too. E.g.: 3.14D
or 3.14BD.
So, should we just introduce a literal shorthand and leave the behavior as is?
> Add DECIMAL data type
> ---------------------
>
> Key: HIVE-2693
> URL: https://issues.apache.org/jira/browse/HIVE-2693
> Project: Hive
> Issue Type: New Feature
> Components: Query Processor, Types
> Affects Versions: 0.10.0
> Reporter: Carl Steinbach
> Assignee: Prasad Mujumdar
> Attachments: 2693_7.patch, 2693_8.patch, 2693_fix_all_tests1.patch,
> HIVE-2693-10.patch, HIVE-2693-11.patch, HIVE-2693-12-SortableSerDe.patch,
> HIVE-2693-13.patch, HIVE-2693-1.patch.txt, HIVE-2693-all.patch,
> HIVE-2693-fix.patch, HIVE-2693.patch, HIVE-2693-take3.patch,
> HIVE-2693-take4.patch
>
>
> Add support for the DECIMAL data type. HIVE-2272 (TIMESTAMP) provides a nice
> template for how to do this.
--
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