0

In Cassandra, you can add and use a new column to a table like this:

cqlsh:mysite> CREATE TABLE mytable (
   url timeuuid,
   PRIMARY KEY (url)
);
cqlsh:mysite> ALTER TABLE mytable ADD tag_tagX text;
cqlsh:mysite> INSERT INTO mytable ( url ) VALUES ( now() );
cqlsh:mysite> SELECT * from mytable;

 url                                  | tag_tagx
--------------------------------------+----------
 ad47de80-8a2c-11e4-8ab4-eb66c236961e |     null

(1 rows)

cqlsh:mysite> CREATE INDEX ON mytable(tag_tagX);
cqlsh:mysite> SELECT * FROM mytable WHERE tag_tagX = null;
code=2200 [Invalid query] message="Unsupported null value for indexed column tag_tagx"

Since Cassandra allows INSERTs of rows without specifying some columns, how can we SELECT rows that do not has this column USED ?

Alain
  • 1,450
  • 3
  • 20
  • 37
  • 1
    possible duplicate of [How Can I Search for Records That Have A Null/Empty Field Using CQL?](http://stackoverflow.com/questions/20981075/how-can-i-search-for-records-that-have-a-null-empty-field-using-cql) – AlexMeng Dec 22 '14 at 23:12
  • @AlexMeng: I posted without revisiting the question title, I fixed it, thanks. The answer from your link is similar but without focusing on the workaround to put in place when facing this situation...how can we create a SELECT that search for rows that do NOT contain any value in the column ? – Alain Dec 22 '14 at 23:18
  • 1
    You cannot select for values of null in Cassandra. You will have to work around it. – AlexMeng Dec 22 '14 at 23:25
  • @AlexMeng: This was a sanity check, I believe you are probably right. Can you post an answer, so that I accept it. – Alain Dec 22 '14 at 23:28

1 Answers1

1

You cannot select for values of null in Cassandra.

AlexMeng
  • 833
  • 8
  • 15