Search code examples
cassandracqlsh

CQLSH - Check for null in where clause for MAP Data type


CASSANDRA Version : 2.1.10

CREATE TABLE customer_raw_data (
  id uuid,
  hash_prefix bigint,
  profile_data map<varchar,varchar>
  PRIMARY KEY (hash_prefix,id));

I have an index on profile_data and I have row where profile_data is null.

How to write a select query to retrieve the rows where profile_data is null ?

I tried the following

select count(*) from customer_raw_data where profile_data=null;

select count(*) from customer_raw_data where profile_data CONTAINS KEY null;

Solution

  • With Reference to : https://issues.apache.org/jira/browse/CASSANDRA-3783

    There is currently no select support for indexed nulls, and given the design of Cassandra, is considered a difficult/prohibitive problem.