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

Float-point numbers are displayed with different precision in Beeline/JDBC

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3.0, 2.0.0, 1.2.2
    • Component/s: None
    • Labels:
      None

      Description

      When inserting float-point numbers to a table, the values displayed on beeline or jdbc are with different precision.

      How to reproduce:

      0: jdbc:hive2://localhost:10000> create table decimals (f float, af array<float>, d double, ad array<double>) stored as parquet;
      No rows affected (0.294 seconds)
      
      0: jdbc:hive2://localhost:10000> insert into table decimals select 1.10058, array(cast(1.10058 as float)), 2.0133, array(2.0133) from dummy limit 1;
      ...
      No rows affected (20.089 seconds)
      
      0: jdbc:hive2://localhost:10000> select f, af, af[0], d, ad[0] from decimals;
      +---------------------+------------+---------------------+---------+---------+--+
      |          f          |     af     |         _c2         |    d    |   _c4   |
      +---------------------+------------+---------------------+---------+---------+--+
      | 1.1005799770355225  | [1.10058]  | 1.1005799770355225  | 2.0133  | 2.0133  |
      +---------------------+------------+---------------------+---------+---------+--+
      

      When displaying arrays, the values are displayed correctly, but if I print a specific element, it is then displayed with more decimal positions.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lijp87 lijp
                Reporter:
                spena Sergio Peña
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: