CREATE TABLE c1.ticket (
uuid int PRIMARY KEY,
idflycompany int
) 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';
而不是
def select(companyId: Int): Future[List[Long]] = {
val select = QueryBuilder.select()
.all()
.from(Connector.KEY_SPACE, table)
.where(like(idFlyCompany, companyId))
for {
resultSet <- session.executeAsync(select)
} yield {
resultSet
.asScala
.map(row => row.getLong("uuid"))
.toList
}
}
有:
找不到非主键列限制支持的辅助索引
但在我的视野中,我使用了一个PK。 怎么了?一些误解的概念?
答案 0 :(得分:1)
问题来自代码中的这一行
where(like(idFlyCompany,companyId))
like()
做的方法是什么?通常,您应该调用QueryBuilder.eq("column name", value)
按主键查询