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

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

bq. i) whether this is a good approach for adding new (optional) types to Avro

+1 for the sub-types. I think that's a good way to provide backward-compat. My 
only reservation is that calling it a "subType" makes me think there is an "is 
a" relationship. What about calling it a "logicalType"?

For existing applications, isn't compatibility covered by the read schema? If 
an application isn't setting the read schema and a file is written with a 
changed schema, then there isn't a strong compatibility guarantee. But setting 
a read schema that doesn't include the subtype annotation should guarantee 
compatibility.

bq. What are the use cases we enable by setting precision and scale on a 
per-record basis rather than setting it in the schema?

The one I came up with is storing decimals with the right number of significant 
figures. The example on 
[wikipedia|https://en.wikipedia.org/wiki/Significance_arithmetic] for 
multiplication is 8.02 * 8.02 = 64.3 (p=3, s=1). BigDecimal will carry out the 
easiest multiplication and produce 64.3204 (p=6, s=4) and the fixed-scale 
representation will produce 62.32 (p=4, s=2) with one extra, non-significant 
figure. But I'm not sure that this is actually something people would (or do) 
use.

bq. smaller scale and precision may be stored in such columns

If it is the case that smaller scales can be stored, then I think we are forced 
into storing the scale as data.

> Support for DECIMAL primitive 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
>            Priority: Minor
>              Labels: Hive
>         Attachments: AVRO-1402.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