Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created March 11, 2020 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpenick/cc58cc4134cfd93518347811100ee1ff to your computer and use it in GitHub Desktop.
Save mpenick/cc58cc4134cfd93518347811100ee1ff to your computer and use it in GitHub Desktop.
CREATE KEYSPACE IF NOT EXISTS test WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'};
CREATE TYPE IF NOT EXISTS test.mytype(a int, b text);
CREATE TABLE IF NOT EXISTS test.table_nulls (key text, s set<int>, m map<text, int>, l list<text>, t tuple<int, text>, u mytype, PRIMARY KEY(key));
// set
INSERT INTO test.table_nulls (key, s) VALUES ('set_null', {null}) ;
// list
INSERT INTO test.table_nulls (key, l) VALUES ('list_null', {null}) ;
// map
INSERT INTO test.table_nulls (key, m) VALUES ('map_key_null', {null: 1}) ;
INSERT INTO test.table_nulls (key, m) VALUES ('map_value_null', {'a': null}) ;
// tuple
INSERT INTO test.table_nulls (key, t) VALUES ('tuple_null', (null, null)) ;
// udt
INSERT INTO test.table_nulls (key, u) VALUES ('udt_null', {a: null, b: null} ) ;
INSERT INTO test.table_nulls (key, u) VALUES ('udt_null_only_one_field', {a: 1, b: null} ) ;
SELECT * from test.table_nulls;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment