[英]datastax java driver select + discardAll
Can I select and distinct in one query? 我可以在一个查询中选择并区分吗?
For example: 例如:
QueryBuilder
.select()
.all()
.from(Connector.KEY_SPACE_NAME, table)
.where(eq(this.uuidHotel, hotelUUID))
.discardAll(this.uuidHotel, javaList)
I cannot understand your column family structure. 我无法理解您的专栏家庭结构。 But your operation seems unusual.
但是您的操作似乎异常。
You are querying for a field called uuidHotel
, so I assume you are querying for UUID type in C*. 您正在查询一个名为
uuidHotel
的字段,所以我假设您正在查询C *中的UUID类型。 It has to be the partition key, else you can't expect a result. 它必须是分区键,否则您将无法预期结果。
But you are also using discardAll
on the same field. 但是,您还在同一字段上使用
discardAll
。 It can only be used on CollectionType fields. 它只能在CollectionType字段上使用。 https://docs.datastax.com/en/cql/3.0/cql/cql_using/use_collections_c.html
https://docs.datastax.com/zh-CN/cql/3.0/cql/cql_using/use_collections_c.html
So it is unusual. 所以这很不寻常。
I think you are looking for is DISTINCT
. 我认为您正在寻找
DISTINCT
。 Please refer to http://docs.datastax.com/en/cql/3.1/cql/cql_reference/select_r.html 请参考http://docs.datastax.com/en/cql/3.1/cql/cql_reference/select_r.html
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.