hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bennie Schut <bsc...@ebuddy.com>
Subject RE: Accessing sub column in hive
Date Fri, 08 Mar 2013 08:09:49 GMT
Perhaps worth posting the error. Some might know what the error means.

Also a bit unrelated to hive but please do yourself a favor and don't use float to store monetary
values like salary. You will get rounding issues at some point in time when you do arithmetic
on them. Considering you are using hadoop you probably have a lot of data so adding it all
up will get you there really really fast. http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency


From: Sai Sai [mailto:saigraph@yahoo.in]
Sent: Thursday, March 07, 2013 12:54 PM
To: user@hive.apache.org
Subject: Re: Accessing sub column in hive

I have a table created like this successfully:

CREATE TABLE IF NOT EXISTS employees (name STRING,salary FLOAT,subordinates ARRAY<STRING>,deductions
  MAP<STRING,FLOAT>,address STRUCT<street:STRING, city:STRING, state:STRING, zip:INT,
country:STRING>)

I would like to access/display country column from my address struct.
I have tried this:

select address["country"] from employees;

I get an error.

Please help.

Thanks
Sai

Mime
View raw message