You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Takahiko Saito (JIRA)" <ji...@apache.org> on 2016/06/04 00:18:59 UTC

[jira] [Created] (HIVE-13946) Decimal value need to be single-quoted when selecting where clause with that decimal value in order to get row

Takahiko Saito created HIVE-13946:
-------------------------------------

             Summary: Decimal value need to be single-quoted when selecting where clause with that decimal value in order to get row
                 Key: HIVE-13946
                 URL: https://issues.apache.org/jira/browse/HIVE-13946
             Project: Hive
          Issue Type: Bug
    Affects Versions: 1.2.1
            Reporter: Takahiko Saito
             Fix For: 1.2.1


Create a table withe a column of decimal type(38,18) and insert '4327269606205.029297'. Then select with that value does not return anything.
{noformat}
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> drop table if exists test;
No rows affected (0.175 seconds)
0: jdbc:hive2://ts-0531-1.openstacklocal:2181>
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> create table test (dc decimal(38,18));
No rows affected (0.098 seconds)
0: jdbc:hive2://ts-0531-1.openstacklocal:2181>
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> insert into table test values (4327269606205.029297);
INFO  : Session is already open
INFO  : Dag name: insert into table tes...327269606205.029297)(Stage-1)
INFO  : Tez session was closed. Reopening...
INFO  : Session re-established.
INFO  :

INFO  : Status: Running (Executing on YARN cluster with App id application_1464727816747_0762)

INFO  : Map 1: -/-
INFO  : Map 1: 0/1
INFO  : Map 1: 0(+1)/1
INFO  : Map 1: 1/1
INFO  : Loading data to table default.test from hdfs://ts-0531-5.openstacklocal:8020/apps/hive/warehouse/test/.hive-staging_hive_2016-06-04_00-03-54_302_7708281807413586675-940/-ext-10000
INFO  : Table default.test stats: [numFiles=1, numRows=1, totalSize=21, rawDataSize=20]
No rows affected (13.821 seconds)
0: jdbc:hive2://ts-0531-1.openstacklocal:2181>
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> select * from test;
+-----------------------+--+
|        test.dc        |
+-----------------------+--+
| 4327269606205.029297  |
+-----------------------+--+
1 row selected (0.078 seconds)
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> select * from test where dc = 4327269606205.029297;
+----------+--+
| test.dc  |
+----------+--+
+----------+--+
No rows selected (0.224 seconds)
{noformat}

If you single quote that decimal value, a row is returned.
{noformat}
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> select * from test where dc = '4327269606205.029297';
+-----------------------+--+
|        test.dc        |
+-----------------------+--+
| 4327269606205.029297  |
+-----------------------+--+
1 row selected (0.085 seconds)
{noformat}

explain shows:
{noformat}
0: jdbc:hive2://ts-0531-1.openstacklocal:2181> explain select * from test where dc = 4327269606205.029297;
+----------------------------------------------------------------------+--+
|                               Explain                                |
+----------------------------------------------------------------------+--+
| STAGE DEPENDENCIES:                                                  |
|   Stage-0 is a root stage                                            |
|                                                                      |
| STAGE PLANS:                                                         |
|   Stage: Stage-0                                                     |
|     Fetch Operator                                                   |
|       limit: -1                                                      |
|       Processor Tree:                                                |
|         TableScan                                                    |
|           alias: test                                                |
|           filterExpr: (dc = 4.3272696062050293E12) (type: boolean)   |
|           Filter Operator                                            |
|             predicate: (dc = 4.3272696062050293E12) (type: boolean)  |
|             Select Operator                                          |
|               expressions: dc (type: decimal(38,18))                 |
|               outputColumnNames: _col0                               |
|               ListSink                                               |
|                                                                      |
+----------------------------------------------------------------------+--+
18 rows selected (0.512 seconds)
{noformat}



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