hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Grover (JIRA)" <>
Subject [jira] [Commented] (HIVE-2693) Add DECIMAL data type
Date Sun, 13 Jan 2013 21:18:12 GMT


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:
select round(mycol,2) from mytable;
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:
>             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:

View raw message