You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by "Oleksandr Diachenko (JIRA)" <ji...@apache.org> on 2016/09/27 19:26:20 UTC

[jira] [Comment Edited] (HAWQ-1054) Real/float4 rounding issues for HiveORC profile

    [ https://issues.apache.org/jira/browse/HAWQ-1054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15527171#comment-15527171 ] 

Oleksandr Diachenko edited comment on HAWQ-1054 at 9/27/16 7:25 PM:
--------------------------------------------------------------------

Issue caused by incorrect type of literal:
{code}
# SELECT t1, r, pg_typeof(7.7) FROM pxf_hive_orc_types LIMIT 1;
  t1  |  r  | pg_typeof 
------+-----+-----------
 row1 | 7.7 | numeric
(1 row)
{code}

In this example 7.7 is being treated as numeric which obviously correct behavior when numeric is not equal to float4 value.

To have proper result literal have to be explicitly casted to float4 datatype:
{code}
SELECT t1, r FROM pxf_hive_orc_types WHERE r = CAST(7.7 as real);
          t1          |  r  
----------------------+-----
 row1                 | 7.7
 row7                 | 7.7
 row8                 | 7.7
 row9                 | 7.7
 row10                | 7.7
 row11                | 7.7
 row12_text_null      | 7.7
 row13_int_null       | 7.7
 row14_double_null    | 7.7
 row15_decimal_null   | 7.7
 row16_timestamp_null | 7.7
 row18_bigint_null    | 7.7
 row19_bool_null      | 7.7
 row20_tinyint_null   | 7.7
 row21_smallint_null  | 7.7
 row22_date_null      | 7.7
 row23_varchar_null   | 7.7
 row24_char_null      | 7.7
 row25_binary_null    | 7.7
(19 rows)
{code}


was (Author: odiachenko):
Issue caused by incorrect type of literal:
{code}
# SELECT t1, r, pg_typeof(7.7) FROM pxf_hive_orc_types LIMIT 1;
  t1  |  r  | pg_typeof 
------+-----+-----------
 row1 | 7.7 | numeric
(1 row)

{code}

> Real/float4 rounding issues for HiveORC profile
> -----------------------------------------------
>
>                 Key: HAWQ-1054
>                 URL: https://issues.apache.org/jira/browse/HAWQ-1054
>             Project: Apache HAWQ
>          Issue Type: Bug
>          Components: PXF
>            Reporter: Oleksandr Diachenko
>            Assignee: Oleksandr Diachenko
>            Priority: Critical
>             Fix For: 2.0.1.0-incubating
>
>
> Looks like real values are being incorrectly rounded:
> {code}
>  SELECT t1, r FROM pxf_hive_orc_types WHERE r = 7.7;
>  t1 | r 
> ----+---
> (0 rows)
> SELECT t1, r FROM pxf_hive_orc_types WHERE r > 7.6;
>           t1          |  r   
> ----------------------+------
>  row1                 |  7.7
>  row2                 |  8.7
>  row3                 |  9.7
>  row4                 | 10.7
>  row5                 | 11.7
>  row6                 | 12.7
>  row7                 |  7.7
>  row8                 |  7.7
>  row9                 |  7.7
>  row10                |  7.7
>  row11                |  7.7
>  row12_text_null      |  7.7
>  row13_int_null       |  7.7
>  row14_double_null    |  7.7
>  row15_decimal_null   |  7.7
>  row16_timestamp_null |  7.7
>  row18_bigint_null    |  7.7
>  row19_bool_null      |  7.7
>  row20_tinyint_null   |  7.7
>  row21_smallint_null  |  7.7
>  row22_date_null      |  7.7
>  row23_varchar_null   |  7.7
>  row24_char_null      |  7.7
>  row25_binary_null    |  7.7
> (24 rows)
> {code}
> The same query works fine in Hive:
> {code}
> hive> select f from hive_orc_all_types where f = 7.7;
> OK
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> 7.7
> Time taken: 0.032 seconds, Fetched: 19 row(s)
> {code}



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