You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Sergey Shelukhin (JIRA)" <ji...@apache.org> on 2016/06/22 01:17:58 UTC

[jira] [Resolved] (HIVE-13928) Hive2: float value need to be single quoted inside where clause to return rows when it doesn't have to be

     [ https://issues.apache.org/jira/browse/HIVE-13928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Shelukhin resolved HIVE-13928.
-------------------------------------
    Resolution: Not A Problem

By design. Quotes may be forcing a different type; overall floating type equalily is not expected to work.

> Hive2: float value need to be single quoted inside where clause to return rows when it doesn't have to be
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-13928
>                 URL: https://issues.apache.org/jira/browse/HIVE-13928
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>            Reporter: Takahiko Saito
>            Priority: Critical
>
> The below select where with float value does not return any row:
> {noformat}
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> drop table test;
> No rows affected (0.212 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> create table test (f float);
> No rows affected (1.131 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> insert into table test values (-35664.76),(29497.34);
> No rows affected (2.482 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test;
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> | 29497.34   |
> +------------+--+
> 2 rows selected (0.142 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test where f = -35664.76;
> +---------+--+
> | test.f  |
> +---------+--+
> +---------+--+
> {noformat}
> The workaround is to single quote float value:
> {noformat}
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test where f = '-35664.76';
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> +------------+--+
> 1 row selected (0.163 seconds)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)