Hi Raihan

To fetch an element of an Array you can just specify the position of the 
element in your query.

Say if you have a table like
'test_table' with a field 'arr_clmn Array<STRING>', you can get the first 
element of the array as

SELECT arr_clmn[0] FROM test_table;

Or if you are looking at exploding the row itself to multiple rows you can do 
so with

SELECT * FROM test_table LATERAL VIEW explode(arr_clmn) exp_arr AS arr_elmnt;

HTH

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: Techy Teck <[email protected]>
Date: Fri, 10 Aug 2012 20:22:26 
To: <[email protected]>
Reply-To: [email protected]
Subject: Re: Exploding Array of String in Hive

Basically How can I get each String outside, something like
*favorite_result [3]
should return *"VAN%2C%20Under%20£1%2C000%2E00%20Ending%20within%202%20days",



On Fri, Aug 10, 2012 at 8:04 PM, Techy Teck <[email protected]> wrote:

> Below is the data in *favorite_result (datatype: array<string>) *column.
> Its an array of String in hive-
>
>
> ["CARS%20500%2E00","cars","VAN%2C%20Under%20£1%2C000%2E00%20Ending%20within%202%20days","COM%20VE","SNAP%20ON%20-LENS%20-BATTERY%20-BELT%20-PHONE%20-IPHONE","Under%20£100%2E00","","","",""]
>
>
> How I can explode this above string in hive?
>

Reply via email to