Astyanax Cassandra Double type precision

自作多情 提交于 2019-12-12 10:47:43

问题


I'm trying to get a Double value from a Cassandra table with a double type column. I've created the table in CQL3 syntax:

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

I've inserted a row:

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

When I do:

SELECT * from data_double;

I get that the value is 123.46

Why is the value rounded?

Thanks


回答1:


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

You can increase this by creating a cqlshrc file with contents like the following:

[ui]
float_precision = 10

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

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



来源:https://stackoverflow.com/questions/23573599/astyanax-cassandra-double-type-precision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!