Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> Hive struct


Copy link to this message
-
Hive struct
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
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB