Hi everybody,

CQL appears to be inconsistent in how it handles predicates.

One type of inconsistencies is that some operators can be used in some
places but not in others or on some expressions but not others.
For example:

   - != can be used in LWT conditions but not elsewhere
   - Token expressions (e.g. token(pk) = ?) support =, >, >=, =< and < but
   not IN
   - Map elements predicates (e.g m[?] = ?) only support =
   - ... (a long list)

This type of inconsistencies can be easily fixed over time.

The other type of inconsistencies that is more confusing is about how we
deal with the combination of multiple predicates as we accept some and
reject others.
For example, we allow: "token(pk) > ? AND pk IN ?" but reject "c > ? AND  c
IN ?".
For CQL, rejection seems to be the norm with only a few exceptions. Whereas
SQL accepts all inputs in terms of predicates combination.

For the IS NULL and IS NOT NULL predicates for partition Key and clustering
columns, that we know cannot be null, that lead us to 2 choices: either
throwing an exception when any of them is specified on partition
keys/clustering columns or accepting them. Ignoring IS NOT NULL as it is a
noop and returning no rows when IS NULL is specified.

I personally prefer the SQL behavior which can result in a simpler code.
Even if I can also understand the defensive approach.

One way or the other, I believe that it would be good to standardize on one
approach and would like to hear your opinion.

Reply via email to