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

Mark Grover commented on HIVE-2693:
-----------------------------------

Gunther: thanks for the feedback! I understand what you are saying about the 
different representation for the same number. That's why I referred to the 
scale change as inconsistencies for floor/ceil but a bug for round. I called 
them inconsistencies for floor/ceil because they are the exact same numbers and 
like we have discussed before the decimal patch considers same numbers with 
different representation equal (by using compareTo() instead of equals()). 
However, here is why I considered it a bug for round because by definition 
round(x,d) rounds number x to d decimal places. While 0.00, 0 and 0E-99 are all 
the same number (with different representation), only one of them has 2 decimal 
places as expected by the result of round(1E-99, 2). Here is an example where 
it could cause problems: if someone was using the thrift client to issue Hive 
queries from C++, and issued a query like this:
{code}
select round(mycol,2) from mytable;
{code}
and split the output based on the decimal point to obtain the fractional part; 
they would expect the fractional part to fit in a string of length of 2. 
However, given the present implementation, that's not the case.

Consistency with MySQL aside, I don't think we should be setting the value back 
to the original scale, especially in round.

Having said the above, I agree that they are just different representations of 
the same number so if you feel strongly about not changing this, I happily +1 
patch 21.
                
> 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-14.patch, HIVE-2693-15.patch, 
> HIVE-2693-16.patch, HIVE-2693-17.patch, HIVE-2693-18.patch, 
> HIVE-2693-19.patch, HIVE-2693-1.patch.txt, HIVE-2693-20.patch, 
> HIVE-2693-21.patch, HIVE-2693-22.patch, HIVE-2693-all.patch, 
> HIVE-2693.D7683.1.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

Reply via email to