You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Julian Keppel <ju...@gmail.com> on 2015/04/30 08:33:50 UTC

Some questions about working with Avro in Hive

I use hive version 0.13.1 in cloudera vm 5.3.0.


I store some (more or less) complex data structures on HDFS and want to
query these data from hive, because I want to develop a somewhat
“relational” structure on this data.


The corresponding avro schema has some union types in it. I created some
tables based on this schema file like described here:
https://cwiki.apache.org/confluence/display/Hive/AvroSerDe#AvroSerDe-CreatingAvro-backedHivetables
.


Some example contents of the tables which are built from this schema file
look like this (just the regarding column):



{0:{"ipadress":"1.74.164.206","url":"http://ustream.tv/molestie/lorem.jpg"}}


I have two questions now:


1) Is there a way to map the single fields of the struct to its own columns
of a hive table?


2) Is there a way to query a union type? For example, if I want to query
the ipadress field, how exactly is this done?


The following query didn’t work: select columnname.ipadress from tablename;


I got “operator is only supported on struct or list of struct types
‘ipadress’”.


It would be great if there is a solution for my problem. Thank you in
advance.