You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Patcharee Thongtra <Pa...@uni.no> on 2015/01/13 09:55:52 UTC

compare float column

Hi,

I have a table with float columns. I tried to query based on the 
condition on a float column (called 'long'), but it failed (nothing 
returned).

hive> select * from test_float where long == -41.338276;
select * from test_float where long == -41.338276
Status: Finished successfully
OK
Time taken: 14.262 seconds

hive> select long from test_float;
select long from test_float
Status: Finished successfully
OK
-41.338276
Time taken: 6.843 seconds, Fetched: 1 row(s)


Any ideas? I am using hive version 0.13.

BR,
Patcharee





Re: compare float column

Posted by Patcharee Thongtra <Pa...@uni.no>.
It works. Thanks!

Patcharee

On 01/13/2015 10:15 AM, Devopam Mittra wrote:
> please try the following and report observation:
>
> WHERE long = CAST(-41.338276 AS FLOAT)
>
>
> regards
> Devopam
>
>
> On Tue, Jan 13, 2015 at 2:25 PM, Patcharee Thongtra 
> <Patcharee.Thongtra@uni.no <ma...@uni.no>> wrote:
>
>     Hi,
>
>     I have a table with float columns. I tried to query based on the
>     condition on a float column (called 'long'), but it failed
>     (nothing returned).
>
>     hive> select * from test_float where long == -41.338276;
>     select * from test_float where long == -41.338276
>     Status: Finished successfully
>     OK
>     Time taken: 14.262 seconds
>
>     hive> select long from test_float;
>     select long from test_float
>     Status: Finished successfully
>     OK
>     -41.338276
>     Time taken: 6.843 seconds, Fetched: 1 row(s)
>
>
>     Any ideas? I am using hive version 0.13.
>
>     BR,
>     Patcharee
>
>
>
>
>
>
>
> -- 
> Devopam Mittra
> Life and Relations are not binary


Re: compare float column

Posted by Devopam Mittra <de...@gmail.com>.
please try the following and report observation:

WHERE long = CAST(-41.338276 AS FLOAT)


regards
Devopam


On Tue, Jan 13, 2015 at 2:25 PM, Patcharee Thongtra <
Patcharee.Thongtra@uni.no> wrote:

> Hi,
>
> I have a table with float columns. I tried to query based on the condition
> on a float column (called 'long'), but it failed (nothing returned).
>
> hive> select * from test_float where long == -41.338276;
> select * from test_float where long == -41.338276
> Status: Finished successfully
> OK
> Time taken: 14.262 seconds
>
> hive> select long from test_float;
> select long from test_float
> Status: Finished successfully
> OK
> -41.338276
> Time taken: 6.843 seconds, Fetched: 1 row(s)
>
>
> Any ideas? I am using hive version 0.13.
>
> BR,
> Patcharee
>
>
>
>
>


-- 
Devopam Mittra
Life and Relations are not binary