Re: how to access array type?

2015-03-02 Thread Alexander Pivovarov
hive create table test1 (c1 arrayint) row format delimited collection
items terminated by ',';
OK

hive insert into test1 select array(1,2,3) from dual;
OK

hive select * from test1;
OK
[1,2,3]

hive select c1[0] from test1;
OK
1

$ hadoop fs -cat /apps/hive/warehouse/test1/00_0
1,2,3



On Sun, Mar 1, 2015 at 11:53 PM, Jie Zhang jiezh2...@gmail.com wrote:

 Hi,

 I am trying to use hive complex data type on hive0.14.0. However, could
 not access the array type as manual indicated. I have an array column, but
 hit SemanticException when access the individual item in the array. Any
 clue? Did I use the wrong syntax or miss some property setting? Thanks!

 hive create table test1 (c1 array int) row format delimited collection
 items terminated by ',';

 OK

 Time taken: 0.092 seconds

 hive select * from test1;

 OK

 [1,2,3]

 Time taken: 0.065 seconds, Fetched: 1 row(s)

 hive select c1[0] from test1;

 FAILED: SemanticException [Error 10004]: Line 1:7 Invalid table alias or
 column reference 'c1[0]': (possible column names are: c1)

 Jessica



how to access array type?

2015-03-01 Thread Jie Zhang
Hi,

I am trying to use hive complex data type on hive0.14.0. However, could not
access the array type as manual indicated. I have an array column, but hit
SemanticException when access the individual item in the array. Any clue?
Did I use the wrong syntax or miss some property setting? Thanks!

hive create table test1 (c1 array int) row format delimited collection
items terminated by ',';

OK

Time taken: 0.092 seconds

hive select * from test1;

OK

[1,2,3]

Time taken: 0.065 seconds, Fetched: 1 row(s)

hive select c1[0] from test1;

FAILED: SemanticException [Error 10004]: Line 1:7 Invalid table alias or
column reference 'c1[0]': (possible column names are: c1)

Jessica