hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahender bigdata <Mahender.BigD...@outlook.com>
Subject Re: Stroing boolean value in Hive table
Date Thu, 18 Feb 2016 20:13:37 GMT
Hi Alan,

Thanks for answering. In HDi 3.1, boolean variables are stored as 0 or 1 
, but from HDI 3.3 , we see Boolean variables are stored as True or 
False in Hive External Table ( i.e Hive File data). Cast or Case will 
work definitely, I'm thinking of any hive setting available to store 1 
or 0 instead of True or False string.



On 2/18/2016 8:56 AM, Alan Gates wrote:
> How the data is stored is up to the storage format (text, rcfile, orc, etc.).  Do you
mean in your text file you’d like booleans stored as 0 or 1?  You could use the case statement
to convert them to integers like:
>
> select case _boolvar_ when true then 1 when false then 0 end from …
>
> Alan.
>
>> On Feb 18, 2016, at 04:18, mahender bigdata <Mahender.BigData@outlook.com>
wrote:
>>
>> Hi,
>>
>> How can we store Boolean value with 1 or 0 instead of storing true or false string.
we can make use of CAST function to convert boolean into 1 or 0. Is there any built-in setting
in hive, which enable and store hive Boolean column values in 0 or 1 instead of true and false.
>>
>>
>>


Mime
View raw message