Re: How to set default value for a certain field

2016-02-23 Thread mahender bigdata
esday, February 23, 2016 1:26 PM *To:* user@hive.apache.org *Subject:* Re: How to set default value for a certain field Any idea on below requirement. On 2/19/2016 2:47 PM, mahender bigdata wrote: Hi, is there Ideal solution in Hive to specify default values at schema level. Currently we are

RE: How to set default value for a certain field

2016-02-23 Thread Riesland, Zack
“null defined as” is what we use From: mahender bigdata [mailto:mahender.bigd...@outlook.com] Sent: Tuesday, February 23, 2016 1:26 PM To: user@hive.apache.org Subject: Re: How to set default value for a certain field Any idea on below requirement. On 2/19/2016 2:47 PM, mahender bigdata wrote

Re: How to set default value for a certain field

2016-02-23 Thread mahender bigdata
Any idea on below requirement. On 2/19/2016 2:47 PM, mahender bigdata wrote: Hi, is there Ideal solution in Hive to specify default values at schema level. Currently we are using *COALESCE *operator in converting null values to default value, this would require reading entire table. But it w

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
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.apache.org > Subject: Re: How to

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

2012-09-05 Thread carla.staeben
7:52 To: user@hive.apache.org Subject: Re: How to set default value for a certain field? You could do something with the coalesce UDF? Phil. On Sep 5, 2012 12:24 AM, "MiaoMiao" mailto:liy...@gmail.com>> wrote: I have a file whose content is: 1,1 2,1 3,2 4, 5, Then I import in into a hive

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