You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Jamie Thomson - Contractor <Ja...@dunnhumby.com> on 2014/06/10 15:25:20 UTC

Dereferencing UNIONTYPE fields

Hi,
First time poster here…


I am using UNIONTYPE field in a Hive table:

, Attributes UNIONTYPE<MAP<STRING,STRING >, STRING>


Here’s a slither of data from that column:

Attributes
---------
{0:{“relevance”:”1.1″}}
{0:{“relevance”:”1.2″}}
{0:{“relevance”:”1.3″}}
{0:{“relevance”:”1.4″}}
{0:{“relevance”:”1.5″}}

How do I dereference the data stored therein? Built-in function CREATE_UNION allows me to define that data, are there any functions that do the opposite? In other words, how do I turn the above data into this:

Relevance
---------
1.1
1.2
1.3
1.4
1.5

Note that Jakob Homan asked a similar question in April 2011 (http://grokbase.com/t/hive/user/114kgbv9zv/evaluating-union-types-in-hive-7) and the answer back then from Amareshwari Sri Ramadasu was that no such functionality existed, I am hoping that that has changed in the interim period.

Thanks in advance
Jamie

dunnhumby limited is a limited company registered in England and Wales with registered number 02388853 and VAT registered number 927 5871 83.
Our registered office is at Aurora House, 71-75 Uxbridge Road, London W5 5SL.
The contents of this message and any attachments to it are confidential and may be legally privileged.
If you have received this message in error you should delete it from your system immediately and advise the sender.
dunnhumby may monitor and record all emails. The views expressed in this email are those of the sender and not those of dunnhumby.