如何处理 cratedb 中的浮点数

how to handle floating-point in cratedb

floating-point

在 cratedb 中进行数学运算时,它会产生浮点数,这是我在 crate 中创建 table 的方法:

创建 table:

create table cash(date string, spend float);
insert into cash(date, spend) values ('2017-05-03', 55.55);
insert into cash(date, spend) values ('2017-05-03', 34.55);
insert into cash(date, spend) values ('2017-05-03', 87.55);
select (0 - spend) sp,* from cash limit 100;

上图是执行selectsql

的结果

cratedb 中的数据类型不支持小数,你对 cratedb 中处理这个问题有什么建议吗?

谢谢

感谢您报告此事。我们已经修复了这个 issue,它也已经与 CrateDB 1.1.3(稳定版)一起发布。

旁注:
此改进检查由算术运算符和十进制值组成的表达式是否仅包含 float 类型。如果是这种情况,结果数据类型将是 float 类型。 如果表达式包含 double 类型的十进制值,则行为与之前一样,结果类型也将是 double.

类型的表示形式