Cassandra在跳过的列中插入空值

时间:2016-04-09 08:07:51

标签: cassandra

有人请帮助我理解为什么Cassandra在跳过的列中插入空值?它不应该跳过这个专栏吗?如果我在插入数据时完全跳过列,它不应该插入任何值(甚至不是null)?我有点困惑,因为根据以下教程,数据按行键与列(列族中的图表)存储,如果为真,那么我不应该为列获取null。

或者我了解Cassandra色谱柱系列的整个概念是错误的?

http://www.tutorialspoint.com/cassandra/cassandra_data_model.htm

这是CQL脚本

create keyspace test WITH replication =  {'class': 'SimpleStrategy',   'replication_factor': '1'};
create table users (firstname text,lastname text,age int, gender ascii, primary key(firstname))
insert into users(firstname,age,gender,lastname) values("Michael",30,"male","smith");

这里,我正在跳过一个列,但是当我运行select查询时,它会为该列显示null。为什么Cassandra在该专栏中填空?

insert into users(firstname,age,gender) values('Jane',23,'female');

select * from users;

1 个答案:

答案 0 :(得分:1)

  1. 为什么不去找Cassandra最全面的文档和学习资源:http://academy.datastax.com?并且免费。内容和tutorialspoint.com非常陈旧,自年龄以来没有更新(SuperColumn自2011年至2012年被弃用......)

  2.   

    这里,我正在跳过一个列,但是当我运行select查询时,它会为该列显示null。为什么Cassandra在该专栏中填空?

  3. 在CQL中,null == value不存在值已被删除

    由于您没有为列 lastname 插入任何值,Cassandra将返回 null (= =在这种情况下不存在)

相关问题