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 Mon, 17 Dec 2012 21:26:14 GMT


Mark Grover commented on HIVE-2693:

Thanks for your comments, [~hagleitn]. Yeah, the right thing moving forward would be to update
BinarySortableSerDe to support BigDecimal. When I thinking of the best way to serialize BigDecimal,
the sign and scale part were easy but I wasn't able to come up with a space efficient way
to store and arbitrary number of digits so they are in-order byte sortable. Correct me if
I am wrong but seems like you are suggesting 1 byte per digit which would work (if the lengths
are equal) but can be dangerous since we are "exploding" an arbitrarily long integer. Having
said that, given Hive's historical philosophy of ignoring malicious intent users, I am ok
with moving forward with that approach.

On a related note, let's talk about the scale.
13267 has a scale of 0 and digits 13267
132.67 has a scale of 2 and digits 13267
132670 has a scale of -1 and digits 13267

So, it seems like the lower scale always means bigger number for positive numbers, so shouldn't
we do
<scale>: -scale for positive numbers (sign byte 1) and scale for negative numbers (sign
byte 0)
instead of 
<scale>: scale integer if sign byte 1, -scale integer otherwise
which you suggested in your previous comment. I am basically asking to flip it around since
negative numbers have sign byte 0 and positive have sign byte.
BTW, feel free to contact me offline if you want to bounce around some ideas!
> 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-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:

View raw message