Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-13908

Beeline adds extra fractional digits when you insert values to table with float data type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.1
    • None
    • None
    • None

    Description

      Via beeline, although -35664.76 is inserted, -35664.76171875 is displayed

      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> drop table test;
      No rows affected (0.067 seconds)
      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> create table test(f float);
      No rows affected (0.248 seconds)
      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> insert into table test values(-35664.76),(29497.34);
      INFO  : Tez session hasn't been created yet. Opening session
      INFO  : Dag name: insert into table tes...35664.76),(29497.34)(Stage-1)
      INFO  :
      
      INFO  : Status: Running (Executing on YARN cluster with App id application_1464727816747_0019)
      
      INFO  : Map 1: -/-
      INFO  : Map 1: 0/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-01_20-16-32_885_9161749848563358684-1/-ext-10000
      INFO  : Table default.test stats: [numFiles=1, numRows=2, totalSize=19, rawDataSize=17]
      No rows affected (31.725 seconds)
      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> select * from test;
      +------------------+--+
      |      test.f      |
      +------------------+--+
      | -35664.76171875  |
      | 29497.33984375   |
      +------------------+--+
      2 rows selected (0.143 seconds)
      

      The issue is not seen via Hive CLI:

      hive> create table test(f float);
      OK
      Time taken: 0.32 seconds
      hive> insert into table test values(-35664.76),(29497.34);
      Query ID = hrt_qa_20160601202446_75f38c5d-f52b-45b3-b67a-8a8b0a194305
      Total jobs = 1
      Launching Job 1 out of 1
      
      
      Status: Running (Executing on YARN cluster with App id application_1464727816747_0020)
      
      --------------------------------------------------------------------------------
              VERTICES      STATUS  TOTAL  COMPLETED  RUNNING  PENDING  FAILED  KILLED
      --------------------------------------------------------------------------------
      Map 1 ..........   SUCCEEDED      1          1        0        0       0       0
      --------------------------------------------------------------------------------
      VERTICES: 01/01  [==========================>>] 100%  ELAPSED TIME: 7.66 s
      --------------------------------------------------------------------------------
      Loading data to table default.test
      Table default.test stats: [numFiles=1, numRows=2, totalSize=19, rawDataSize=17]
      OK
      Time taken: 11.477 seconds
      hive> select * from test;
      OK
      -35664.76
      29497.34
      Time taken: 0.144 seconds, Fetched: 2 row(s)
      

      hdfs file shows expected value:

      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> dfs -cat hdfs://ts-0531-5.openstacklocal:8020/apps/hive/warehouse/test/000000_0
      0: jdbc:hive2://ts-0531-1.openstacklocal:2181> ;
      +-------------+--+
      | DFS Output  |
      +-------------+--+
      | -35664.76   |
      | 29497.34    |
      +-------------+--+
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            taksaito Takahiko Saito
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: