hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Chauhan (JIRA)" <>
Subject [jira] [Commented] (HIVE-5320) Querying a table with nested struct type over JSON data results in errors
Date Fri, 20 Sep 2013 20:58:53 GMT


Ashutosh Chauhan commented on HIVE-5320:

I am not sure we want this. Whole point of Object Inspector based design is object reuse and
lazy evaluation. By defensively copying, we are giving up on that. Agreed this put an onus
on serde implementers to do "right thing" but thats how it is. I suggest you go with the option
1 in the options you have listed.
> Querying a table with nested struct type over JSON data results in errors
> -------------------------------------------------------------------------
>                 Key: HIVE-5320
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Serializers/Deserializers
>    Affects Versions: 0.9.0
>            Reporter: Chaoyu Tang
>            Assignee: Chaoyu Tang
>         Attachments: HIVE-5320.patch
> Querying a table with nested_struct datatype like
> ==
> create table nest_struct_tbl (col1 string, col2 array<struct<a1:string, a2:array<struct<b1:int,
b2:string, b3:string>>>>) ROW FORMAT SERDE '';

> ==
> over JSON data cause errors including java.lang.IndexOutOfBoundsException or corrupted
> The JsonSerDe used is json-serde-1.1.4.jar/json-serde-1.1.4-jar-dependencies.jar.
> The cause is that the method:
> public List<Object> getStructFieldsDataAsList(Object o) 
> in 
> returns a list referencing to a static arraylist "values"
> So the local variable 'list' in method serialize of Hive LazySimpleSerDe class is returned
with same reference in its recursive calls and its element values are kept on being overwritten
in the case STRUCT.
> Solutions:
> 1. Fix in JsonSerDe, and change the field 'values' in
> to instance scope.
> Filed a ticket to JSonSerDe (
> 2. Ideally, in the method serialize of class LazySimpleSerDe, we should defensively save
a copy of a list resulted from list = soi.getStructFieldsDataAsList(obj) in which case the
soi is the instance of JsonStructObjectInspector, so that the recursive calls of serialize
can work properly regardless of the extended SerDe implementation.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message