hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Valluri, Sathish" <>
Subject Hive Avro union data access
Date Thu, 29 May 2014 10:41:32 GMT

I have an Hive table created with 3 different union data types for alias_host column name
as shown. (array<string>,string, null).

CREATE EXTERNAL TABLE array_tests ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
WITH SERDEPROPERTIES ('avro.schema.literal'='{"name":"sessions","type":"record","fields":[{"default":null,"name":"alias_host","type":

      "type" : "array",

      "items" : "string"


'' LOCATION '/arrayTests';

How to access and query the contents of this table in where clause.

The queries below like these can be possible if the datatype is not union but when once I
set the datatype as union the following queries are failing.

Eg: select alias_host from array_tests where alias_host like ‘%test%’ limit 1000;

Error: Error while processing statement: FAILED: SemanticException [Error 10016]: Line 1:32
Argument type mismatch 'alias_host': The 1st argument of EQUAL  is expected to a primitive
type, but union is found (state=42000,code=10016)

Can anyone suggest how to access and query the contents of union data types.


Sathish Valluri

View raw message