hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xuefu Zhang (JIRA)" <>
Subject [jira] [Commented] (HIVE-7049) Unable to deserialize AVRO data when file schema and record schema are different and nullable
Date Tue, 13 May 2014 17:24:14 GMT


Xuefu Zhang commented on HIVE-7049:

Thanks for bringing this up.  I'm wondering if the situation you described is an issue of
incompatibility of schemas rather than a bug. Record schema says that a field is union (nullable),
while file schema says that the file is not a union, which seems suggesting that the data
is not compatible with the schema. While we may need to provided a better error message for
this, ignoring the file schema (by passing NULL down) will very likely break decimal support,
which needs the file schema to read data correctly.

> Unable to deserialize AVRO data when file schema and record schema are different and
> ---------------------------------------------------------------------------------------------
>                 Key: HIVE-7049
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Mohammad Kamrul Islam
>            Assignee: Mohammad Kamrul Islam
>         Attachments: HIVE-7049.1.patch
> It mainly happens when 
> 1 )file schema and record schema are not same
> 2 ) Record schema is nullable  but file schema is not.
> The potential code location is at class AvroDeserialize
> {noformat}
>  if(AvroSerdeUtils.isNullableType(recordSchema)) {
>       return deserializeNullableUnion(datum, fileSchema, recordSchema, columnType);
>     }
> {noformat}
> In the above code snippet, recordSchema is verified if it is nullable. But the file schema
is not checked.
> I tested with these values:
> {noformat}
> recordSchema= ["null","string"]
> fielSchema= "string"
> {noformat}
> And i got the following exception <line numbers might not be the same due to mu debugged
code version>.
> {noformat}
> org.apache.avro.AvroRuntimeException: Not a union: "string" 
>         at org.apache.avro.Schema.getTypes(
>         at org.apache.hadoop.hive.serde2.avro.AvroDeserializer.deserializeNullableUnion(
>         at org.apache.hadoop.hive.serde2.avro.AvroDeserializer.worker(
>         at org.apache.hadoop.hive.serde2.avro.AvroDeserializer.workerBase(
>         at org.apache.hadoop.hive.serde2.avro.AvroDeserializer.deserialize(
>         at org.apache.hadoop.hive.serde2.avro.TestAvroDeserializer.verifyNullableType(
>         at org.apache.hadoop.hive.serde2.avro.TestAvroDeserializer.canDeserializeNullableTypes(
> {noformat}

This message was sent by Atlassian JIRA

View raw message