Re: How to set default value for a certain field?

2012-09-05 Thread MiaoMiao
Thank you all, guess I just have to do it this way. On Thu, Sep 6, 2012 at 11:50 AM, Philip Tromans wrote: > Yep. It's not an ideal solution, but it gets you part of the way there. Hive > doesn't have a way of specifying default values at schema level. > > Phil. > > On Sep 5, 2012 11:38 PM, "Miao

Re: How to set default value for a certain field?

2012-09-05 Thread Philip Tromans
Yep. It's not an ideal solution, but it gets you part of the way there. Hive doesn't have a way of specifying default values at schema level. Phil. On Sep 5, 2012 11:38 PM, "MiaoMiao" wrote: > You mean COALESCE(value,3)? This does work on int field, and easier than IF > > select value,COALESCE(v

Re: How to set default value for a certain field?

2012-09-05 Thread MiaoMiao
You mean COALESCE(value,3)? This does work on int field, and easier than IF select value,COALESCE(value,3) from testtest; 1 1 1 1 2 2 NULL3 NULL3 On Wed, Sep 5, 2012 at 7:52 PM, Philip Tromans wrote: > You could do something with the coalesce UDF? > > Phil. > > On Sep 5

Re: How to set default value for a certain field?

2012-09-05 Thread MiaoMiao
COALESCE how? COALESCE(VALUE) will return VALUE or null. I know this query works select IF(VALUE is NULL,3,VALUE) from testtest; But I have to do this conditional check on every possible field, every time I perform queries. I mean, does Hive have something like CREATE TABLE table (field INT NOT N

Re: How to set default value for a certain field?

2012-09-05 Thread MiaoMiao
This will certainly work, but with 20 tables, each of 20GB size, using insert overwrite could take up both time and space a lot. On Wed, Sep 5, 2012 at 7:57 PM, wrote: > Well, you could create the table and then insert overwrite from the file: > > > > Insert overwrite > > Select id, case when va

RE: question on output hive table to file

2012-09-05 Thread Tony Burton
I use the following example to set my own delimiter, I hope it's easy to adjust for your own needs: hive> create external table input (a int, b string, c float) row format delimited fields terminated by "\t" stored as sequencefile location 's3://path/to/data/input/'; hive> create external table

RE: How to set default value for a certain field?

2012-09-05 Thread carla.staeben
Well, you could create the table and then insert overwrite from the file: Insert overwrite Select id, case when value = '' then 3 else value end as value >From testtest; Carla From: ext Philip Tromans [mailto:philip.j.trom...@gmail.com] Sent: Wednesday, September 05, 2012 07:52 To: user@hive.apa

Re: How to set default value for a certain field?

2012-09-05 Thread Philip Tromans
You could do something with the coalesce UDF? Phil. On Sep 5, 2012 12:24 AM, "MiaoMiao" wrote: > I have a file whose content is: > 1,1 > 2,1 > 3,2 > 4, > 5, > Then I import in into a hive table. > create external table testtest (id int,value int) row format delimited > fields terminated by ',' s

Re: New Learner for Haddop and Hive

2012-09-05 Thread Bertrand Dechoux
1) First do not post across multiple mailing list. I am replying to all in order to share my answer but you should then reply only on the mailing list which is concerned with your issue. 2) Does you hadoop installation work? If not, ask u...@hadoop.apache.org 3) Does your hive installation work? If

Re: Improving query performance on hive and hdfs

2012-09-05 Thread Bertrand Dechoux
It would be interesting to know the size of the data, how it is stored within Hive and what kind of query you run on it. Typically, 90 000 000 records could be less than 64 Mo and could even be all loaded into memory. In that case, yes, it is not astonishing that alternatives could outperform Hado

Role management

2012-09-05 Thread Gerardo Vázquez
Hi all, I've just started playing with permissions on Hive, and although I can create/drop roles and use grant/revoke but I'm not been able to find something like 'show roles' to display all the roles. I know I can retrieve this info from the metastore (mysql), Is there any other way to do th