Last active
December 28, 2015 23:39
-
-
Save nicolasff/7580238 to your computer and use it in GitHub Desktop.
test.cql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat test.cql | |
DROP KEYSPACE yo; | |
CREATE KEYSPACE yo WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1}; | |
USE yo; | |
CREATE TABLE foo ( | |
x text, | |
y int, | |
z crdt('org.apache.cassandra.db.MinLongCrdt'), | |
t crdt('org.apache.cassandra.db.MaxLongCrdt'), | |
PRIMARY KEY (x)) | |
WITH compression = {'sstable_compression': ''} | |
; | |
UPDATE foo SET y=12, z=1, t=0 WHERE x = 'hello'; | |
UPDATE foo SET y=34, z=0, t=2 WHERE x = 'hello'; | |
UPDATE foo SET y=56, z=2, t=1 WHERE x = 'hello'; | |
SELECT * FROM foo WHERE x = 'hello'; | |
DELETE z FROM foo WHERE x = 'hello'; | |
SELECT * FROM foo WHERE x = 'hello'; | |
UPDATE foo SET y=78, z=99, t=1 WHERE x = 'hello'; | |
SELECT * FROM foo WHERE x = 'hello'; | |
UPDATE foo SET y=90, z=0, t=1 WHERE x = 'hello'; | |
SELECT * FROM foo WHERE x = 'hello'; | |
INSERT INTO foo (x,y,z,t) VALUES ('world', 12, 1, 0); | |
INSERT INTO foo (x,y,z,t) VALUES ('world', 34, 0, 2); | |
INSERT INTO foo (x,y,z,t) VALUES ('world', 56, 2, 1); | |
SELECT * FROM foo WHERE x = 'world'; | |
// Check name selection rather than range | |
SELECT x,t,y,z FROM foo WHERE x = 'world'; | |
$ ./bin/cqlsh < test.cql | |
<stdin>:2:Bad Request: Cannot drop non existing keyspace 'yo'. | |
x | t | y | z | |
-------+---+----+--- | |
hello | 2 | 56 | 0 | |
(1 rows) | |
x | t | y | z | |
-------+---+----+------ | |
hello | 2 | 56 | null | |
(1 rows) | |
x | t | y | z | |
-------+---+----+---- | |
hello | 2 | 78 | 99 | |
(1 rows) | |
x | t | y | z | |
-------+---+----+--- | |
hello | 2 | 90 | 0 | |
(1 rows) | |
x | t | y | z | |
-------+---+----+--- | |
world | 2 | 56 | 0 | |
(1 rows) | |
x | t | y | z | |
-------+---+----+--- | |
world | 2 | 56 | 0 | |
(1 rows) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment