CQLSH - 检查 MAP 数据类型的 where 子句中是否为空
CQLSH - Check for null in where clause for MAP Data type
CASSANDRA 版本:2.1.10
CREATE TABLE customer_raw_data (
id uuid,
hash_prefix bigint,
profile_data map<varchar,varchar>
PRIMARY KEY (hash_prefix,id));
我在 profile_data 上有一个索引,并且我有行 profile_data 为空。
如何编写 select 查询来检索 profile_data 为空的行?
我尝试了以下
select count(*) from customer_raw_data where profile_data=null;
select count(*) from customer_raw_data where profile_data CONTAINS KEY null;
基本问题。
其中条件列必须是主键或二级索引,因此使您的列适合,然后尝试下面的查询。
试试这个..
select count(*) from customer_raw_data where profile_data='';
参考:https://issues.apache.org/jira/browse/CASSANDRA-3783
目前 select 不支持索引空值,鉴于 Cassandra 的设计,被认为是 difficult/prohibitive 问题。
SELECT * FROM TableName WHERE colName > 5000 允许过滤; //工作正常
SELECT * FROM TableName WHERE colName > 5000 limit 10 ALLOW FILTERING;
https://cassandra.apache.org/doc/old/CQL-3.0.html
检查 "ALLOW FILTERING" 部分。
CASSANDRA 版本:2.1.10
CREATE TABLE customer_raw_data (
id uuid,
hash_prefix bigint,
profile_data map<varchar,varchar>
PRIMARY KEY (hash_prefix,id));
我在 profile_data 上有一个索引,并且我有行 profile_data 为空。
如何编写 select 查询来检索 profile_data 为空的行?
我尝试了以下
select count(*) from customer_raw_data where profile_data=null;
select count(*) from customer_raw_data where profile_data CONTAINS KEY null;
select count(*) from customer_raw_data where profile_data='';
参考:https://issues.apache.org/jira/browse/CASSANDRA-3783
目前 select 不支持索引空值,鉴于 Cassandra 的设计,被认为是 difficult/prohibitive 问题。
SELECT * FROM TableName WHERE colName > 5000 允许过滤; //工作正常
SELECT * FROM TableName WHERE colName > 5000 limit 10 ALLOW FILTERING;
https://cassandra.apache.org/doc/old/CQL-3.0.html
检查 "ALLOW FILTERING" 部分。