Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 62A1C1023C for ; Wed, 20 Nov 2013 15:29:29 +0000 (UTC) Received: (qmail 13256 invoked by uid 500); 20 Nov 2013 15:29:25 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 12644 invoked by uid 500); 20 Nov 2013 15:29:20 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 12636 invoked by uid 99); 20 Nov 2013 15:29:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Nov 2013 15:29:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sylvain@datastax.com designates 209.85.160.52 as permitted sender) Received: from [209.85.160.52] (HELO mail-pb0-f52.google.com) (209.85.160.52) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Nov 2013 15:29:12 +0000 Received: by mail-pb0-f52.google.com with SMTP id uo5so3603163pbc.25 for ; Wed, 20 Nov 2013 07:28:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=YgQgKLTulnvGjzWF4ig2QFmte/zY/sVdDFGNyI0L9E0=; b=ZT04WdRQ/82w8AyjAWb0lwRLJwcn9q2ynZKGhhIPLVIXnRhRQfMgKugi/P3Svd8tLl VeqszGeOFrSr1PTFPGcxPE7j24t8b8SkVzdRYvZAljFjHpy8JETjDSgukzbP5CGb0D/l 6EXzQ5Ide2uTaJu9Imn7J1Rnpdb6QYpZD7ADJ62S67Yb5AiFXTtvMR+8FRAudZH671id JSvTAgPNrbKvABfeTbNNewTHL+Lam02tj2vj62NnDhLsPQrBaIW88pIYJX8ZS5tKLLFG oQDqT/GEXlzdS5A5tWaLIgq+oHiMwT5vnAd9F5xDaXiXphtQoeAf/Kgk/qhsRBEwlNx1 tAMg== X-Gm-Message-State: ALoCoQm4xBR5SP9VgX2eNalSwO3iut4RaKzhxtsNRXmPQ4YsAPJO4wUhnCvrYqbldNsqTfXgi2co MIME-Version: 1.0 X-Received: by 10.66.26.204 with SMTP id n12mr1130457pag.159.1384961331507; Wed, 20 Nov 2013 07:28:51 -0800 (PST) Received: by 10.68.23.105 with HTTP; Wed, 20 Nov 2013 07:28:51 -0800 (PST) In-Reply-To: References: Date: Wed, 20 Nov 2013 16:28:51 +0100 Message-ID: Subject: Re: support for nulls in composite lost in CQL3 From: Sylvain Lebresne To: "user@cassandra.apache.org" Content-Type: multipart/alternative; boundary=bcaec5299359314bbd04eb9d70d6 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec5299359314bbd04eb9d70d6 Content-Type: text/plain; charset=ISO-8859-1 > 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 --bcaec5299359314bbd04eb9d70d6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
>= 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 doe= s not consider that every type should
have an empty value and so, while it ultimately = does support empty values for
every type (f= or thrift compatibility sake), it does not encourage them for a
number of types. In particular, numeric types don't have constants to r= epresent
the empty value (while types that = do support empty values naturally do have
e= asy representation for it, like Ox for the blob type or '' for the = text type).

Anyway, lik= e I said above, there is no easy syntax for it but you can have empty
=
values even for numeric types like int. If you u= se prepared statement, since
those take values as binary, just sending an emp= ty 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 pr= obably
blobAsInt(0x) (that is, the empty bl= ob 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:
=A0 SELECT * FROM myTable WHERE firstCol=3DblobA= sInt(0x)

--
Sylvain
--bcaec5299359314bbd04eb9d70d6--