gpt4 book ai didi

Cassandra 创建表不会保持列顺序

转载 作者:行者123 更新时间:2023-12-04 16:59:11 27 4
gpt4 key购买 nike

我正在 Cassandra 中创建一个列族,我希望列顺序与我在 create 子句中指定的顺序相匹配。

这个

CREATE TABLE cf.mycf (
timestamp timestamp,
id text,
score int,
type text,
publisher_id text,
embed_url text,
PRIMARY KEY (timestamp, id, score)
) WITH bloom_filter_fp_chance = 0.01
AND comment = ''
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 = '99.0PERCENTILE'
AND caching = {
'keys' : 'ALL',
'rows_per_partition' : 'NONE'
}
AND compression = {
'chunk_length_kb' : 64,
'crc_check_chance' : 1.0,
'sstable_compression' : 'LZ4Compressor'
}
AND compaction = {
'base_time_seconds' : 60,
'class' : 'DateTieredCompactionStrategy',
'enabled' : true,
'max_sstable_age_days' : 365,
'max_threshold' : 32,
'min_threshold' : 4,
'timestamp_resolution' : 'MICROSECONDS',
'tombstone_compaction_interval' : 86400,
'tombstone_threshold' : 0.2,
'unchecked_tombstone_compaction' : false
};

应该创建一个表,如: timestamp ,id ,score , type, id ,embed_url
相反,我得到了这个:
timestamp timestamp,
id text,
score int,
embed_url text,
publisher_id text,
type text,

我已经以相同的方式创建了很多表,但这种情况从未发生过,因此我们将不胜感激。

我把 idscore作为显示这些保持各自位置的关键。而我正在寻找的实际方案只是作为主键的时间戳。

最佳答案

看起来在 cassandra 中没有字段顺序之类的东西。

The others columns are displayed in alphabetical order by Cassandra. 

http://docs.datastax.com/en/cql/3.1/cql/ddl/ddl_compound_keys_c.html

关于Cassandra 创建表不会保持列顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34072768/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com