You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by RD <rd...@gmail.com> on 2016/11/22 04:39:51 UTC

Does hive/ql/src/test/queries/clientpositive/avro_decimal.q violate avro schema evolution?

I ask because I was re-looking at
https://issues.apache.org/jira/browse/HIVE-4734 and how to support newer
data types (Decimal, Varchar, Char)

In this qtest, we write using a schema containing a decimal having
precision 5 and scale 2 (decimal(5,2)) , but when reading the same data we
set the read schema having a decimal data type of decimal(4,1) . This test
produces correct results* (because the AvroSerde uses the file schema and
not the reader schema to read the decimal type)* but is the schema
evolution  for the decimal type valid?

Avro schema evolution spec is not very clear what is a valid evolution rule
for decimal types. From the Avro spec (
http://avro.apache.org/docs/1.8.1/spec.html#Decimal) I see the following
comment

*For the purposes of schema resolution, two schemas that
> are decimal logical types match if their scales and precisions match.*


Is this effectively saying that reading schema for decimal type should
match in precision and scale with the writer schema?