* bened...@apache.org <bened...@apache.org> [22/06/15 18:38]: > I expect LET to behave like SELECT, and I don’t expect this work to modify > the behaviour of normal CQL expressions. Do you think there is something > wrong or inconsistent about the behaviours you mention? > > Static columns are a bit weird, but at the very least the following would > permit the user to reliably obtain a static value, if it exists: > > LET x = some_static_column FROM table WHERE partitionKey = someKey LIMIT 1 > > This could be mixed with a clustering key query > > LET y = some_regular_column FROM table WHERE partitionKey = someKey AND > clusteringKey = someOtherKey
I think static rows should not be selectable outside clustering rows. This violates relational model. Unfortunately currently they sometimes are. Here's an example: > create table t (p int, c int, r int, s int static, primary key(p, c)); OK > insert into t (p, s) values (1,1) if not exists; +-------------+------+------+------+------+ | [applied] | p | c | s | r | |-------------+------+------+------+------| | True | null | null | null | null | +-------------+------+------+------+------+ > -- that's right, there is a row now; what row though? > select count(*) from t; +---------+ | count | |---------| | 1 | +---------+ > -- let's add more rows > insert into t (p, c, s) values (1,1,1) if not exists; +-------------+------+------+------+------+ | [applied] | p | c | s | r | |-------------+------+------+------+------| | True | null | null | null | null | +-------------+------+------+------+------+ > -- we did not add more rows? > select count(*) from t; +---------+ | count | |---------| | 1 | +---------+ In LWT, a static row appears to exist when there is no regular row matching WHERE. It would be nice to somehow either be consistent in LET with existing SELECTs, or, so to speak, be consistently inconsistent, i.e. consistent with some other vendor, and not come up with a whole new semantics for static rows, different from LWT and SELECTs. This is why I was making all these comments about missing rows -there is no incongruence in classic SQL, any vendor, because a) there are no static rows b) NULLs are first-class values, distinguishable from unset values. -- Konstantin Osipov, Moscow, Russia