如何 store/show 具有 15 位小数精度的时间戳和双列?

How to store/show timestamp and double columns with 15 decimal precision?

我想将实验数据插入到 Cassandra 中,其中每个数据的精度为小数点后 15 位。样本数据集如下:

+------------------+-------------------+
|   Sampling_Rate  |       Value1      |
+------------------+-------------------+
| 2.48979187011719 | 0.144110783934593 |
+------------------+-------------------+

我希望将 Sampling_Rate 视为纪元时间(即 1970-01-01 00:00:02.48979187011719+ 0000) 和 Value1 来存储其完整精度值。

为此,我插入了描述为 table 的数据:

CREATE TABLE project_fvag.temp (
    sampling_rate timestamp PRIMARY KEY,
    value1 double ) WITH bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

我还更改了 cqlshrc 文件,提高了 float 和 double 的精度。此外,更改了日期时间格式:

datetimeformat = %Y-%m-%d %H:%M:%S.%.15f%z ;float_precision = 5 ;double_precision = 15

尽管有这些更改,我得到的结果在时间戳和值中都只存储为小数点后 6 位。按照我的预期,store/see 有什么更好的策略?

对于采样值:因为你把它设置为时间戳,cassandra会以毫秒精度存储它。一种方法是将其存储为十进制。

同样适用于value1。为 value1 用小数而不是双精度重新创建 table。