You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by lei liu <li...@gmail.com> on 2011/01/21 10:09:42 UTC

what char represents NULL value in hive?

I generate HDFS file , then I load the file to one hive table. There are
some colums are don't have value, I need to set these colums to NULL.   I
want to know what char represents NULL value in hive.


Thanks,

LiuLei

Re: what char represents NULL value in hive?

Posted by Bennie Schut <bs...@ebuddy.com>.
At least on trunk it seems on external tables(perhaps also TextFile?) 
this works for integer values but not for string values. For a string it 
will then return as an empty string which you then have to find with " 
where field = '' " but I would prefer to use " where field is null ".
Not sure if this should be filed as a bug or a missing feature ;-)
Perhaps there is a relation with HIVE-1791?

On 01/21/2011 02:03 PM, Ajo Fod wrote:
> For a tab separated file, I think it is the null string ... i.e no
> characters. So, for example
>
> 12\ta\t\t2
> 1\tb\ta\t1
>
> reads
> 12     a<NULL>       2
> 1        b      a              1
>
> On Fri, Jan 21, 2011 at 1:09 AM, lei liu<li...@gmail.com>  wrote:
>> I generate HDFS file , then I load the file to one hive table. There are
>> some colums are don't have value, I need to set these colums to NULL.   I
>> want to know what char represents NULL value in hive.
>>
>>
>> Thanks,
>>
>> LiuLei
>>
>>
>>


Re: what char represents NULL value in hive?

Posted by Ajo Fod <aj...@gmail.com>.
For a tab separated file, I think it is the null string ... i.e no
characters. So, for example

12\ta\t\t2
1\tb\ta\t1

reads
12     a    <NULL>      2
1        b      a              1

On Fri, Jan 21, 2011 at 1:09 AM, lei liu <li...@gmail.com> wrote:
> I generate HDFS file , then I load the file to one hive table. There are
> some colums are don't have value, I need to set these colums to NULL.   I
> want to know what char represents NULL value in hive.
>
>
> Thanks,
>
> LiuLei
>
>
>

Re: what char represents NULL value in hive?

Posted by 김영우 <wa...@gmail.com>.
Hi LiuLei,

You should use '\N' for null in your data files.

- Youngwoo

2011/1/21 lei liu <li...@gmail.com>

> I generate HDFS file , then I load the file to one hive table. There are
> some colums are don't have value, I need to set these colums to NULL.   I
> want to know what char represents NULL value in hive.
>
>
> Thanks,
>
> LiuLei
>
>
>