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

Xuefu Zhang commented on AVRO-1402:
-----------------------------------

{quote}
precision, a JSON integer representing the (maximum) precision of decimals 
stored in this type (optional)
{quote}

Looking at the spec, I'm wondering what's the precision if it's not specified 
in the type definition. Shouldn't we have a default value like scale?

When we define a column of decimal type w/o giving precision/scale In a DB such 
as MySQL, "decimal" is the same as "decimal(10)" and "decimal(10,0)".

While precision isn't required to reconstruct the data, it's important for 
metadata operations. For instance, what's the type of "d1+d2" where d1 and d2 
are two decimal columns? Without knowing precision and scale of both d1 and d2, 
we will not be able to determine the result metadata for this calculation.

Thus, I suggest we either have a default value (such as 10) as we do for scale, 
or make precision a required attribute. The former seems more reasonable.

> 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-logical-type-spec.patch, 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