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

Ryan Blue commented on AVRO-1402:
---------------------------------

bq. There have been objections to the approach implemented here on the basis 
that there’s no a clear use case for storing decimals with different scales in 
the same field.

I think there is a use case that avro needs to care about: `BigDecimal` is used 
to avoid floating point error, but not just for money where scale is almost 
always 2. If I'm storing precise measurements, I could end up with different 
incoming scales from different equipment used to take the measurement. This 
works just fine up until the `BigDecimal` is stored in avro, at which point 
avro would throw an exception and force the caller to mutate the data, if avro 
forces data points to have the same scale.

There are real-world cases where this happens. GPS data comes to mind, where 
newer receivers have better location resolution and it's important to keep the 
most precise measurement taken.

> Support for DECIMAL type
> ------------------------
>
>                 Key: AVRO-1402
>                 URL: https://issues.apache.org/jira/browse/AVRO-1402
>             Project: Avro
>          Issue Type: New Feature
>    Affects Versions: 1.7.5
>            Reporter: Mariano Dominguez
>            Assignee: Tom White
>            Priority: Minor
>              Labels: Hive
>             Fix For: 1.7.7
>
>         Attachments: AVRO-1402.patch, AVRO-1402.patch, AVRO-1402.patch, 
> AVRO-1402.patch, UnixEpochRecordMapping.patch
>
>
> Currently, Avro does not seem to support a DECIMAL type or equivalent.
> http://avro.apache.org/docs/1.7.5/spec.html#schema_primitive
> Adding DECIMAL support would be particularly interesting when converting 
> types from Avro to Hive, since DECIMAL is already a supported data type in 
> Hive (0.11.0).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to