Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在cassandra中存储6位精度的双精度/浮点数/十进制数?_Cassandra_Datastax Enterprise_Databricks - Fatal编程技术网

如何在cassandra中存储6位精度的双精度/浮点数/十进制数?

如何在cassandra中存储6位精度的双精度/浮点数/十进制数?,cassandra,datastax-enterprise,databricks,Cassandra,Datastax Enterprise,Databricks,我试图在cassandra表中存储数据帧的一些字符串。 我尝试将cassandra表列定义为float/double/decimal 但每种类型仅存储2个精度,即8.00005存储为8.00 69.345和69.34一样,卡桑德拉表有什么问题?为什么它不能保存所有的精确数字。如何解决这个问题?如果需要有关该问题的更多信息,请告诉我。此问题与cqlsh的精度设置有关。 cassandra正确地存储了这些值,但当您通过cqlsh查询时,精度点设置会将其舍入 有关精度点的更多信息,请阅读cqlshrc

我试图在cassandra表中存储数据帧的一些字符串。 我尝试将cassandra表列定义为float/double/decimal

但每种类型仅存储2个精度,即8.00005存储为8.00
69.345和69.34一样,卡桑德拉表有什么问题?为什么它不能保存所有的精确数字。如何解决这个问题?如果需要有关该问题的更多信息,请告诉我。

此问题与cqlsh的精度设置有关。 cassandra正确地存储了这些值,但当您通过cqlsh查询时,精度点设置会将其舍入

有关精度点的更多信息,请阅读cqlshrc选项:

以下是默认的cqlshrc设置:

;; The number of digits displayed after the decimal point for single and double 
precision numbers
;; (note that increasing this to large numbers can result in unusual values)
;float_precision = 5
检查以下示例:

create table temp(id int , "val" float ,PRIMARY KEY (id));

insert into temp(id,val) values(1,1.234567);
在设置浮动精度之前选择:

select * from temp;

 id | val
----+---------
 1 | 1.23457
将浮点精度设置为6后选择:

select * from temp;

 id | val
----+----------
 1 | 1.234567

这个问题似乎与cqlsh的精度设置有关。 cassandra正确地存储了这些值,但当您通过cqlsh查询时,精度点设置会将其舍入

有关精度点的更多信息,请阅读cqlshrc选项:

以下是默认的cqlshrc设置:

;; The number of digits displayed after the decimal point for single and double 
precision numbers
;; (note that increasing this to large numbers can result in unusual values)
;float_precision = 5
检查以下示例:

create table temp(id int , "val" float ,PRIMARY KEY (id));

insert into temp(id,val) values(1,1.234567);
在设置浮动精度之前选择:

select * from temp;

 id | val
----+---------
 1 | 1.23457
将浮点精度设置为6后选择:

select * from temp;

 id | val
----+----------
 1 | 1.234567

@AlexOtta,先生,您对此有何评论?@AlexOtta,先生,您对此有何评论?如何在创建表格时设置浮点精度?@user3252097该值以适当的精度存储在表格中。仅当显示时,该值才被舍入。使用指定的设置,可以更改结果显示期间要设置的精度。它不是表级属性。如何在创建表时设置float_精度?@user3252097该值以适当的精度存储在表中。仅当显示时,该值才被舍入。使用指定的设置,可以更改结果显示期间要设置的精度。它不是表级属性。