incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Lebresne <sylv...@datastax.com>
Subject Re: support for nulls in composite lost in CQL3
Date Wed, 20 Nov 2013 15:28:51 GMT
> but from what I understand, there is no support for this in CQL3?

Whether or not there is "support" probably depends on your definition of
"support". It is "possible" to do in CQL3 if that is your question.

What can be said however is that CQL3 does not consider that every type
should
have an empty value and so, while it ultimately does support empty values
for
every type (for thrift compatibility sake), it does not encourage them for a
number of types. In particular, numeric types don't have constants to
represent
the empty value (while types that do support empty values naturally do have
easy representation for it, like Ox for the blob type or '' for the text
type).

Anyway, like I said above, there is no easy syntax for it but you can have
empty
values even for numeric types like int. If you use prepared statement, since
those take values as binary, just sending an empty binary value will work
(you
may have to check your client driver to see how to do that though).
But otherwise, the simplest way to get an empty value for say, a int, is
probably
blobAsInt(0x) (that is, the empty blob value 0x but "cast" to an int to make
the type system happy).

> how do I get all the values with an empty prefix in CQL3?

Provided what's above, you'd do something like:
  SELECT * FROM myTable WHERE firstCol=blobAsInt(0x)

--
Sylvain

Mime
View raw message