Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-7095

Cqlsh reads floats and doubles with added non-trivial precision

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Not A Problem
    • None
    • Legacy/Tools
    • None
    • Ubuntu 12.04.3
      Python 2.7.3

    • Normal

    Description

      I found that on Cqlsh v. 4.1.1 and Cassandra 2.0.6.28 when I inserted value into float or double column, "select" returned a slightly different value

      If cqlsh returns with only a low level precision, this does not show:

      cqlsh> create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor':1};
      cqlsh> use test ;
      cqlsh:test> create table testing (a int PRIMARY KEY , b float);
      cqlsh:test> INSERT INTO testing (a, b ) VALUES (  1, 2.0002);
      cqlsh:test> select * FROM testing ;
      
       a | b
      ---+--------
       1 | 2.0002
      
      

      But if precision is increased, for example, 20 digits:

      cqlsh> SELECT * FROM test.testing ;
      
       a | b
      ---+-----------------------
       1 | 2.0002000331878662109
      

      Using sstable2json, one sees that this issue is with cqlsh, the actual data is the value inserted:

      sstable2json /var/lib/cassandra/data/test/testing/test-testing-jb-1-Data.db 
      [
      {"key": "00000001","columns": [["","",1398459775180000], ["b","2.0002",1398459775180000]]}
      ]
      

      Attachments

        Activity

          People

            mishail Mikhail Stepura
            A_Spitz Andrew Spitzer
            Mikhail Stepura
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: