Astyanax Cassandra Dual Type Precision

I am trying to get a double value from a Cassandra table with a double type column. I created a table in CQL3 syntax:

CREATE TABLE data_double ( datetime timestamp, value double, primary key (datetime) ); 

I inserted the line:

 INSERT INTO data_double (datetime, value) VALUES ('111111111', 123.456); 

When I do this:

 SELECT * from data_double; 

I get that value is 123.46

Why is the value rounded?

thanks

+6
source share
1 answer

The cqlsh utility will only display 5 precision digits for floating point numbers by default.

This can be increased by creating a cqlshrc file with the following contents:

 [ui] float_precision = 10 

The cqlsh docs page provides more information on the options available.

Update: The location of the cqlshrc file changed at some point in Cassandra. The new default location is ~/.cassandra/cqlshrc . You can also use the file elsewhere with the --cqlshrc command-line --cqlshrc .

+7
source

All Articles