Thanks Vikas,

I did see the below URL before posting but it is not clear to me how I run a 
select query.

For example, if the union ‘x’ is:
         uniontype<struct<a:string,b:bigint>,struct<c:int>>
Then how do I run the query:
         select x.a from tbl;

Thanks
Sachin


From: hadoop hive <hadooph...@gmail.com<mailto:hadooph...@gmail.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Monday, August 11, 2014 at 12:14 PM
To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Subject: Re: How to query UNION types in Hive with Avro


Hi Sachin,

Here is the doc from hwk, this might help you.

http://docs.hortonworks.com/HDPDocuments/HDP1/HDP-1.2.2/ds_Hive/language_manual/datatypes.html#LanguageManualTypes-UnionTypes

Thanks
Vikas Srivastava

On Aug 12, 2014 12:31 AM, "Sachin Goyal" 
<sgo...@walmartlabs.com<mailto:sgo...@walmartlabs.com>> wrote:
Hi,

I am using Hive and Avro with union types as follows:


hive> desc tbl1;

productid         
uniontype<void,struct<productid:string,itemid:bigint>,struct<circularrefid:int>>
 from deserializer



hive> select productid from tbl1;

{1:{"productid":"34","itemid":null}}



hive> select productid.productid from tbl1

FAILED: SemanticException [Error 10042]: Line 1:7 . Operator is only supported 
on struct or list of struct types 'productid'



Does anyone know how to use the union-types inside a select query?


Thanks

Sachin

Reply via email to