Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - Hive struct


Copy link to this message
-
Hive struct
abhishek 2013-05-03, 04:28
hi all,

Please share your view on how can I do this

i have query in hive where one column is struct(1 to n strings),second column is string

i want to compare struct of first and last element with second column string, if first element matches i should get output first or last element matches with the second column then I should get last anything else should be null or 0
Example:

column 1 |  column 2
<a,b,c,d>  |     a
<w,x,y,z>  |     z
<p,w,r,s>  |     w

I want to print this table as

column 1      |  column 2  | column 3
<a,b,c,d>      |     a               |     first
<w,x,y,z>      |     z                |     second
<p,w,r,s>      |     w               |      null or 0

Regards
Abhi
+
Stephen Sprague 2013-05-03, 18:21