stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
14 stars 16 forks source link

[Tables] `$or`, `$not` and `$and` lost in forming the CQL in findOne #1741

Open hemidactylus opened 2 days ago

hemidactylus commented 2 days ago

(and presumably find as well).

All the findOne filters below result in the following CQL (suppose text is the primary key, but this is not necessarily relevant (consequently, the returned row is also wrong):

SELECT x,text FROM default_keyspace.a LIMIT 1

Filters attempted:

f1 = { "$and": [{ "text": "0" }, { "text": "b" }] }
f2 = { "$or": [{ "text": "0" }, { "text": "b" }] }
f3 = { "$not": { "$or": [{ "text": "0" }, { "text": "a" }] } }
f4 = { "$and": [{ "text": "0" }, { "text": "0" }] }

Counterexample (sanity check)

A simple filter, { "text": "b" } does return the expected row and indeed translates to SELECT x,text FROM default_keyspace.a WHERE text=? LIMIT 1, values=[b]

Yuqi-Du commented 2 days ago

Thanks, $and and $or are not merged, it is not in current preview. Will leave this issue open.