cassandra는 null 필드를 지원하지 않으니. null 대신 default 값을 잘 사용하는 것이 좋다.


$ ./cqlsh

Connected to Test Cluster at 127.0.0.1:9042.

[cqlsh 5.0.1 | Cassandra 2.1.10 | CQL spec 3.2.1 | Native protocol v3]

Use HELP for help.

cqlsh>

cqlsh>

cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1 } ;

cqlsh> use test ;

cqlsh:test> CREATE TABLE foo (name text, age int, pet text, primary key (name)) ;

cqlsh:test> insert into foo (name, age, pet) values ('yves', 81, 'german shepherd') ;

cqlsh:test> insert into foo (name, pet) values ('coco', 'ferret') ;

cqlsh:test> SELECT * FROM foo ;


 name | age  | pet

------+------+-----------------

 coco | null |          ferret

 yves |   81 | german shepherd



cqlsh:test> SELECT * FROM foo WHERE age=null;

InvalidRequest: code=2200 [Invalid query] message="Unsupported null value for indexed column age"


Posted by '김용환'
,