Vinod Jayachandran
Vinod Jayachandran

Reputation: 3898

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;

Upvotes: 1

Views: 1865

Answers (3)

Debojyoti Mukherjee
Debojyoti Mukherjee

Reputation: 11

SELECT * FROM TableName WHERE colName > 5000 ALLOW FILTERING; //Work fine

SELECT * FROM TableName WHERE colName > 5000 limit 10 ALLOW FILTERING;

https://cassandra.apache.org/doc/old/CQL-3.0.html

Check the "ALLOW FILTERING" Part.

Upvotes: 0

Helping Hand..
Helping Hand..

Reputation: 2440

enter image description hereBasic problem. where condition column has to be either primary key or secondary index so make your column what-ever is suitable and then try below query. Try this..

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

Upvotes: 1

Vinod Jayachandran
Vinod Jayachandran

Reputation: 3898

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.

Upvotes: 1

Related Questions