diff --git a/cassandra/pom.xml b/cassandra/pom.xml
index 57b501a7a69..1b825b4f0da 100644
--- a/cassandra/pom.xml
+++ b/cassandra/pom.xml
@@ -35,18 +35,19 @@
| Keyspace | +${aggregate.keyspace} | +
| Arguments | +${aggregate.arguments.toList.mkString(", ")} | +
| State Function | +${aggregate.sFunc} | +
| State Type | +${aggregate.sType} | +
| Final Function | +${aggregate.finalFunc.get} | +
| Initial State | +${aggregate.initCond.get} | +
| Return type | +${aggregate.returnType} | +
| Aggregate | +Return Type | +
|---|---|
| ${aggregate.name + aggregate.arguments.mkString("(", ", ", ")")} | +${aggregate.returnType} | +
| Function | +Return Type | +
|---|---|
| ${function.name + function.arguments.mkString("(",", ", ")")} | +${function.returnType} | +
| Materialized View |
|---|
| + ${mv.name} + + + ${mv.baseTable} + | +
| Tables |
|---|
| UDT |
|---|
| ${udt} |
| Keyspace | +${function.keyspace} | +|
| Arguments | +${function.arguments.toList.mkString(", ")} | +|
| Null Input | + #if(function.calledOnNullInput) +CALLED ON NULL INPUT | + #else +RETURN NULL ON NULL INPUT | + #end +
| Return type | +${function.returnType} | +|
| Language | +${function.language} | +|
| Body | +${escape(function.body)} | +
It is possible to add comments between statements. Single line comments start with the
- hash sign (#). Multi-line comments are enclosed between
+ hash sign (#) or double slashes (//). Multi-line comments are enclosed between
/** and **/. Ex:
@@ -246,9 +258,12 @@
- #First comment
+ #Single line comment style 1
INSERT INTO users(login,name) VALUES('jdoe','John DOE');
+ //Single line comment style 2
+
+
/**
Multi line
comments
@@ -313,6 +328,22 @@
DESCRIBE TABLES;
List all existing keyspaces in the cluster and for each, all the tables name
+
+ DESCRIBE TYPES;
+ List all existing keyspaces in the cluster and for each, all the types name
+
+
+ DESCRIBE FUNCTIONS;
+ List all existing keyspaces in the cluster and for each, all the functions name and arguments
+
+
+ DESCRIBE AGGREGATES;
+ List all existing keyspaces in the cluster and for each, all the aggregates name and arguments
+
+
+ DESCRIBE MATERIALIZED VIEWS;
+ List all existing keyspaces in the cluster and for each, all the materialized view name
+
DESCRIBE KEYSPACE <keyspace name>;
Describe the given keyspace configuration and all its table details (name, columns, ...)
@@ -333,6 +364,30 @@
the default system keyspace is used. If no type is found, an error message is raised
+
+ DESCRIBE FUNCTION (<keyspace name>).<function name>;
+
+ Describe the given function. If the keyspace is not provided, the current
+ logged in keyspace is used. If there is no logged in keyspace,
+ the default system keyspace is used. If no function is found, an error message is raised
+
+
+
+ DESCRIBE AGGREGATE (<keyspace name>).<aggregate name>;
+
+ Describe the given aggregate. If the keyspace is not provided, the current
+ logged in keyspace is used. If there is no logged in keyspace,
+ the default system keyspace is used. If no aggregate is found, an error message is raised
+
+
+
+ DESCRIBE MATERIALIZED VIEW (<keyspace name>).<view name>;
+
+ Describe the given materialized view. If the keyspace is not provided, the current
+ logged in keyspace is used. If there is no logged in keyspace,
+ the default system keyspace is used. If no materialized view is found, an error message is raised
+
+
@@ -342,9 +397,7 @@
II Schema Display
- The schema objects (cluster, keyspace, table & type) are displayed in a tabular format.
- There is a drop-down menu on the top left corner to expand objects details.
- On the top right menu is shown the Icon legend.
+ The schema objects (cluster, keyspace, table, type, view, function & aggregate) are displayed in a tabular format. There is a drop-down menu on the top left corner to expand objects details. On the top right menu is shown the Icon legend.
| Materialized Views | +
| Functions | +
| Aggregates | +
| Column Type | +Column Name | +Data Type | +
|---|---|---|
| + + | +${column.name} | +${column.dataType} | +
| + + | +${column.name} | +${column.dataType} | +
| + + + + | +${column.name} | +${column.dataType} | +
| + + + + | +${column.name} | +${column.dataType} | +
| + | ${column.name} | +${column.dataType} | +
| Name | +Target | +
|---|---|
| ${index.name} | +${index.target} | +
| Partitioner | -
|---|
| org.apache.cassandra.dht.Murmur3Partitioner | -
| Partitioner |
|---|
| org.apache.cassandra.dht.Murmur3Partitioner |
| Replication | -Durable Writes | -
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | -false | -
CREATE KEYSPACE live_data WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.SimpleStrategy',
- 'replication_factor': '1' }
-AND DURABLE_WRITES = false;
- | Tables | -
| Column Type | -Column Name | -Data Type | -
|---|---|---|
| - - - - - | -pk1 | -uuid | -
| - - - - - pk2idx - - | -pk2 | -int | -
| - - - - - | -my_static1 | -text | -
| - - - - - | -my_static2 | -text | -
| - - - - - - - | -clustering1 | -timestamp | -
| - - - - - - - clustering2idx - - | -clustering2 | -int | -
| - - - - - - - | -clustering3 | -text | -
| - - - - | -entries_indexed_map | -map<int, text> | -
| - - - - idx1 - - | -indexed1 | -text | -
| - - - - idx2 - - | -indexed2 | -int | -
| - - - - keys_map_idx - - | -key_indexed_map | -map<int, text> | -
| - - - - | -my_list | -list<text> | -
| - - - - | -my_map | -map<int, text> | -
| - - - - | -my_udt | -frozen<live_data.address> | -
| - - - - | -my_udt_list | -frozen<list<frozen<live_data.address>>> | -
| - - - - | -simple | -double | -
CREATE TABLE live_data.complex_table (
- pk1 uuid,
- pk2 int,
- clustering1 timestamp,
- clustering2 int,
- clustering3 text,
- entries_indexed_map map<int, text>,
- indexed1 text,
- indexed2 int,
- key_indexed_map map<int, text>,
- my_list list<text>,
- my_map map<int, text>,
- my_static1 text static,
- my_static2 text static,
- my_udt frozen<live_data.address>,
- my_udt_list frozen<list<frozen<live_data.address>>>,
- simple double,
- PRIMARY KEY ((pk1, pk2), clustering1, clustering2, clustering3)
-) WITH CLUSTERING ORDER BY (clustering1 DESC, clustering2 ASC, clustering3 DESC)
- AND read_repair_chance = 0.0
- AND dclocal_read_repair_chance = 0.1
- AND gc_grace_seconds = 864000
- AND bloom_filter_fp_chance = 0.01
- AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
- AND comment = ''
- AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
- AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
- AND default_time_to_live = 0
- AND speculative_retry = '99.0PERCENTILE'
- AND min_index_interval = 128
- AND max_index_interval = 2048;
-CREATE INDEX pk2idx ON live_data.complex_table (pk2);
-CREATE INDEX clustering2idx ON live_data.complex_table (clustering2);
-CREATE INDEX idx1 ON live_data.complex_table (indexed1);
-CREATE INDEX idx2 ON live_data.complex_table (indexed2);
-CREATE INDEX keys_map_idx ON live_data.complex_table (KEYS(key_indexed_map));
- | Column Type | -Column Name | -Data Type | -
|---|---|---|
| - - - - - | -sensor_id | -uuid | -
| - - - - - | -month | -int | -
| - - - - - | -characteristics | -map<text, text> | -
| - - - - - | -model_number | -text | -
| - - - - - | -provider | -text | -
| - - - - - - - | -date | -timestamp | -
| - - - - | -value | -double | -
CREATE TABLE live_data.sensor_data (
- sensor_id uuid,
- month int,
- date timestamp,
- characteristics map<text, text> static,
- model_number text static,
- provider text static,
- value double,
- PRIMARY KEY ((sensor_id, month), date)
-) WITH CLUSTERING ORDER BY (date DESC)
- AND read_repair_chance = 0.0
- AND dclocal_read_repair_chance = 0.1
- AND gc_grace_seconds = 864000
- AND bloom_filter_fp_chance = 0.01
- AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
- AND comment = ''
- AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
- AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
- AND default_time_to_live = 0
- AND speculative_retry = '99.0PERCENTILE'
- AND min_index_interval = 128
- AND max_index_interval = 2048;
- | Column Type | -Column Name | -Data Type | -
|---|---|---|
| - - - - - | -station_id | -uuid | -
| - - - - | -sensors | -frozen<map<uuid, frozen<live_data.geolocation>>> | -
CREATE TABLE live_data.stations (
- station_id uuid,
- sensors frozen<map<uuid, frozen<live_data.geolocation>>>,
- PRIMARY KEY (station_id)
-) WITH read_repair_chance = 0.0
- AND dclocal_read_repair_chance = 0.1
- AND gc_grace_seconds = 864000
- AND bloom_filter_fp_chance = 0.01
- AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
- AND comment = ''
- AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
- AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
- AND default_time_to_live = 0
- AND speculative_retry = '99.0PERCENTILE'
- AND min_index_interval = 128
- AND max_index_interval = 2048;
- | User Defined Types | -
| Column Name | -Data Type | -
|---|---|
| number | -int | -
| street | -text | -
| zip | -int | -
| city | -text | -
| country | -text | -
CREATE TYPE live_data.address ( - number int, - street text, - zip int, - city text, - country text -);-
| Column Name | -Data Type | -
|---|---|
| latitude | -double | -
| longitude | -double | -
CREATE TYPE live_data.geolocation ( - latitude double, - longitude double -);-
| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | false |
CREATE KEYSPACE live_data WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '1' }AND DURABLE_WRITES = false;| Tables |
| Column Type | Column Name | Data Type |
|---|---|---|
| pk1 | uuid | |
| pk2 | int | |
| my_static1 | text | |
| my_static2 | text | |
| clustering1 | timestamp | |
| clustering2 | int | |
| clustering3 | text | |
| entries_indexed_map | map<int, text> | |
| indexed1 | text | |
| indexed2 | int | |
| key_indexed_map | map<int, text> | |
| my_list | list<text> | |
| my_map | map<int, text> | |
| my_udt | frozen<live_data.address> | |
| my_udt_list | frozen<list<frozen<live_data.address>>> | |
| simple | double |
CREATE TABLE live_data.complex_table (pk1 uuid,pk2 int,clustering1 timestamp,clustering2 int,clustering3 text,entries_indexed_map map<int, text>,indexed1 text,indexed2 int,key_indexed_map map<int, text>,my_list list<text>,my_map map<int, text>,my_static1 text static,my_static2 text static,my_udt frozen<live_data.address>,my_udt_list frozen<list<frozen<live_data.address>>>,simple double,PRIMARY KEY ((pk1, pk2), clustering1, clustering2, clustering3)) WITH CLUSTERING ORDER BY (clustering1 DESC, clustering2 ASC, clustering3 DESC)AND read_repair_chance = 0.0AND dclocal_read_repair_chance = 0.1AND gc_grace_seconds = 864000AND bloom_filter_fp_chance = 0.01AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }AND comment = ''AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }AND default_time_to_live = 0AND speculative_retry = '99.0PERCENTILE'AND min_index_interval = 128AND max_index_interval = 2048;| Name | Target |
|---|---|
| clustering2idx | clustering2 |
| idx1 | indexed1 |
| idx2 | indexed2 |
| keys_map_idx | keys(key_indexed_map) |
| pk2idx | pk2 |
CREATE INDEX clustering2idx ON live_data.complex_table (clustering2);CREATE INDEX idx1 ON live_data.complex_table (indexed1);CREATE INDEX idx2 ON live_data.complex_table (indexed2);CREATE INDEX keys_map_idx ON live_data.complex_table (keys(key_indexed_map));CREATE INDEX pk2idx ON live_data.complex_table (pk2);
| Column Type | Column Name | Data Type |
|---|---|---|
| sensor_id | uuid | |
| month | int | |
| characteristics | map<text, text> | |
| model_number | text | |
| provider | text | |
| date | timestamp | |
| value | double |
CREATE TABLE live_data.sensor_data (sensor_id uuid,month int,date timestamp,characteristics map<text, text> static,model_number text static,provider text static,value double,PRIMARY KEY ((sensor_id, month), date)) WITH CLUSTERING ORDER BY (date DESC)AND read_repair_chance = 0.0AND dclocal_read_repair_chance = 0.1AND gc_grace_seconds = 864000AND bloom_filter_fp_chance = 0.01AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }AND comment = ''AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }AND default_time_to_live = 0AND speculative_retry = '99.0PERCENTILE'AND min_index_interval = 128AND max_index_interval = 2048;| Column Type | Column Name | Data Type |
|---|---|---|
| station_id | uuid | |
| sensors | frozen<map<uuid, frozen<live_data.geolocation>>> |
CREATE TABLE live_data.stations (station_id uuid,sensors frozen<map<uuid, frozen<live_data.geolocation>>>,PRIMARY KEY (station_id)) WITH read_repair_chance = 0.0AND dclocal_read_repair_chance = 0.1AND gc_grace_seconds = 864000AND bloom_filter_fp_chance = 0.01AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }AND comment = ''AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }AND default_time_to_live = 0AND speculative_retry = '99.0PERCENTILE'AND min_index_interval = 128AND max_index_interval = 2048;| User Defined Types |
| Column Name | Data Type |
|---|---|
| number | int |
| street | text |
| zip | int |
| city | text |
| country | text |
CREATE TYPE live_data.address (number int,street text,zip int,city text,country text);
| Column Name | Data Type |
|---|---|
| latitude | double |
| longitude | double |
| Partitioner | -
|---|
| org.apache.cassandra.dht.Murmur3Partitioner | -
| Keyspaces | -
| Replication | -Durable Writes | -
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | -false | -
CREATE KEYSPACE live_data WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.SimpleStrategy',
- 'replication_factor': '1' }
-AND DURABLE_WRITES = false;
- | Replication | -Durable Writes | -
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | -false | -
CREATE KEYSPACE samples WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.SimpleStrategy',
- 'replication_factor': '1' }
-AND DURABLE_WRITES = false;
- | Replication | -Durable Writes | -
|---|---|
| {'class' : 'org.apache.cassandra.locator.LocalStrategy'} | -true | -
CREATE KEYSPACE system WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.LocalStrategy' }
-AND DURABLE_WRITES = true;
- | Replication | -Durable Writes | -
|---|---|
| {'replication_factor' : '2', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | -true | -
CREATE KEYSPACE system_traces WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.SimpleStrategy',
- 'replication_factor': '2' }
-AND DURABLE_WRITES = true;
- | Replication | -Durable Writes | -
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | -false | -
CREATE KEYSPACE zeppelin WITH REPLICATION = {
- 'class' : 'org.apache.cassandra.locator.SimpleStrategy',
- 'replication_factor': '1' }
-AND DURABLE_WRITES = false;
- | Partitioner |
|---|
| org.apache.cassandra.dht.Murmur3Partitioner |
| Keyspaces |
| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | false |
CREATE KEYSPACE live_data WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '1' }AND DURABLE_WRITES = false;| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | false |
CREATE KEYSPACE samples WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '1' }AND DURABLE_WRITES = false;| Replication | Durable Writes |
|---|---|
| {'class' : 'org.apache.cassandra.locator.LocalStrategy'} | true |
CREATE KEYSPACE system WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.LocalStrategy' }AND DURABLE_WRITES = true;| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | true |
CREATE KEYSPACE system_auth WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '1' }AND DURABLE_WRITES = true;| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '3', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | true |
CREATE KEYSPACE system_distributed WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '3' }AND DURABLE_WRITES = true;| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '2', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | true |
CREATE KEYSPACE system_traces WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '2' }AND DURABLE_WRITES = true;| Replication | Durable Writes |
|---|---|
| {'replication_factor' : '1', 'class' : 'org.apache.cassandra.locator.SimpleStrategy'} | true |
CREATE KEYSPACE zeppelin WITH REPLICATION = {'class' : 'org.apache.cassandra.locator.SimpleStrategy','replication_factor': '1' }AND DURABLE_WRITES = true;| Column Type | -Column Name | -Data Type | -
|---|---|---|
| - - - - - | -pk1 | -uuid | -
| - - - - - pk2idx - - | -pk2 | -int | -
| - - - - - | -my_static1 | -text | -
| - - - - - | -my_static2 | -text | -
| - - - - - - - | -clustering1 | -timestamp | -
| - - - - - - - clustering2idx - - | -clustering2 | -int | -
| - - - - - - - | -clustering3 | -text | -
| - - - - | -entries_indexed_map | -map<int, text> | -
| - - - - idx1 - - | -indexed1 | -text | -
| - - - - idx2 - - | -indexed2 | -int | -
| - - - - keys_map_idx - - | -key_indexed_map | -map<int, text> | -
| - - - - | -my_list | -list<text> | -
| - - - - | -my_map | -map<int, text> | -
| - - - - | -my_udt | -frozen<live_data.address> | -
| - - - - | -my_udt_list | -frozen<list<frozen<live_data.address>>> | -
| - - - - | -simple | -double | -
CREATE TABLE live_data.complex_table (
- pk1 uuid,
- pk2 int,
- clustering1 timestamp,
- clustering2 int,
- clustering3 text,
- entries_indexed_map map<int, text>,
- indexed1 text,
- indexed2 int,
- key_indexed_map map<int, text>,
- my_list list<text>,
- my_map map<int, text>,
- my_static1 text static,
- my_static2 text static,
- my_udt frozen<live_data.address>,
- my_udt_list frozen<list<frozen<live_data.address>>>,
- simple double,
- PRIMARY KEY ((pk1, pk2), clustering1, clustering2, clustering3)
-) WITH CLUSTERING ORDER BY (clustering1 DESC, clustering2 ASC, clustering3 DESC)
- AND read_repair_chance = 0.0
- AND dclocal_read_repair_chance = 0.1
- AND gc_grace_seconds = 864000
- AND bloom_filter_fp_chance = 0.01
- AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
- AND comment = ''
- AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }
- AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
- AND default_time_to_live = 0
- AND speculative_retry = '99.0PERCENTILE'
- AND min_index_interval = 128
- AND max_index_interval = 2048;
-CREATE INDEX pk2idx ON live_data.complex_table (pk2);
-CREATE INDEX clustering2idx ON live_data.complex_table (clustering2);
-CREATE INDEX idx1 ON live_data.complex_table (indexed1);
-CREATE INDEX idx2 ON live_data.complex_table (indexed2);
-CREATE INDEX keys_map_idx ON live_data.complex_table (KEYS(key_indexed_map));
- | Column Type | Column Name | Data Type |
|---|---|---|
| pk1 | uuid | |
| pk2 | int | |
| my_static1 | text | |
| my_static2 | text | |
| clustering1 | timestamp | |
| clustering2 | int | |
| clustering3 | text | |
| entries_indexed_map | map<int, text> | |
| indexed1 | text | |
| indexed2 | int | |
| key_indexed_map | map<int, text> | |
| my_list | list<text> | |
| my_map | map<int, text> | |
| my_udt | frozen<live_data.address> | |
| my_udt_list | frozen<list<frozen<live_data.address>>> | |
| simple | double |
CREATE TABLE live_data.complex_table (pk1 uuid,pk2 int,clustering1 timestamp,clustering2 int,clustering3 text,entries_indexed_map map<int, text>,indexed1 text,indexed2 int,key_indexed_map map<int, text>,my_list list<text>,my_map map<int, text>,my_static1 text static,my_static2 text static,my_udt frozen<live_data.address>,my_udt_list frozen<list<frozen<live_data.address>>>,simple double,PRIMARY KEY ((pk1, pk2), clustering1, clustering2, clustering3)) WITH CLUSTERING ORDER BY (clustering1 DESC, clustering2 ASC, clustering3 DESC)AND read_repair_chance = 0.0AND dclocal_read_repair_chance = 0.1AND gc_grace_seconds = 864000AND bloom_filter_fp_chance = 0.01AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }AND comment = ''AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' }AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor' }AND default_time_to_live = 0AND speculative_retry = '99.0PERCENTILE'AND min_index_interval = 128AND max_index_interval = 2048;| Name | Target |
|---|---|
| clustering2idx | clustering2 |
| idx1 | indexed1 |
| idx2 | indexed2 |
| keys_map_idx | keys(key_indexed_map) |
| pk2idx | pk2 |
CREATE INDEX clustering2idx ON live_data.complex_table (clustering2);CREATE INDEX idx1 ON live_data.complex_table (indexed1);CREATE INDEX idx2 ON live_data.complex_table (indexed2);CREATE INDEX keys_map_idx ON live_data.complex_table (keys(key_indexed_map));CREATE INDEX pk2idx ON live_data.complex_table (pk2);
| Column Name | -Data Type | -
|---|---|
| number | -int | -
| street | -text | -
| zip | -int | -
| city | -text | -
| country | -text | -
CREATE TYPE live_data.address ( - number int, - street text, - zip int, - city text, - country text -);-
| Column Name | Data Type |
|---|---|
| number | int |
| street | text |
| zip | int |
| city | text |
| country | text |
CREATE TYPE live_data.address (number int,street text,zip int,city text,country text);
| Column Name | -Data Type | -
|---|---|
| number | -int | -
| street | -text | -
| zip | -int | -
| city | -text | -
| country | -text | -
CREATE TYPE live_data.address ( - number int, - street text, - zip int, - city text, - country text -);-
| Column Name | Data Type |
|---|---|
| number | int |
| street | text |
| zip | int |
| city | text |
| country | text |
CREATE TYPE live_data.address (number int,street text,zip int,city text,country text);
This interpreter is compatible with any CQL statement supported by Cassandra. Ex:
-
-
-
- INSERT INTO users(login,name) VALUES('jdoe','John DOE');
- SELECT * FROM users WHERE login='jdoe';
-
- - - USE spark_demo; - - SELECT * FROM albums_by_country LIMIT 1; SELECT * FROM countries LIMIT 1; - - SELECT * - FROM artists - WHERE login='jlennon'; --
-
- BEGIN BATCH
- INSERT INTO users(login,name) VALUES('jdoe','John DOE');
- INSERT INTO users_preferences(login,account_type) VALUES('jdoe','BASIC');
- APPLY BATCH;
-
- CREATE TABLE IF NOT EXISTS test(
- key int PRIMARY KEY,
- value text
- );
-
-
-
- INSERT INTO users(login,name) VALUES('jdoe','John DOE');
- Insert into users(login,name) vAlues('hsue','Helen SUE');
-
- | Cassandra version | Documentation |
|---|---|
| 2.2 | -- - http://docs.datastax.com/en/cql/3.3/cql/cqlIntro.html - - | -
| 2.1 & 2.0 | -- - http://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html - - | -
| 1.2 | -- - http://docs.datastax.com/en/cql/3.0/cql/aboutCQL.html - - | -
- It is possible to add comments between statements. Single line comments start with the
- hash sign (#). Multi-line comments are enclosed between
- /** and **/. Ex:
-
-
-
-
-
- #First comment
- INSERT INTO users(login,name) VALUES('jdoe','John DOE');
-
- /**
- Multi line
- comments
- **/
- Insert into users(login,name) vAlues('hsue','Helen SUE');
-
-
- The interpreters is shipped with a built-in syntax validator. This validator only
- checks for basic syntax errors. All CQL-related syntax validation is delegated
- directly to Cassandra
-
- Most of the time, syntax errors are due to missing semi-colons between statements or typo errors.
-
-
- To make schema discovery easier and more interactive, the following commands are supported:
-
-
| Command | Description |
|---|---|
| DESCRIBE CLUSTER; | -Show the current cluster name and its partitioner | -
| DESCRIBE KEYSPACES; | -List all existing keyspaces in the cluster and their configuration - (replication factor, durable write ...) | -
| DESCRIBE TABLES; | -List all existing keyspaces in the cluster and for each, all the tables name | -
| DESCRIBE KEYSPACE <keyspace name>; | -Describe the given keyspace configuration and all its table details (name, columns, ...) | -
| DESCRIBE TABLE (<keyspace name>).<table name>; | -- Describe the given table. If the keyspace is not provided, the current - logged in keyspace is used. If there is no logged in keyspace, - the default system keyspace is used. If no table is found, an error message is raised - | -
| DESCRIBE TYPE (<keyspace name>).<type name>; | -- Describe the given type(UDT). If the keyspace is not provided, the current - logged in keyspace is used. If there is no logged in keyspace, - the default system keyspace is used. If no type is found, an error message is raised - | -
- The schema objects (cluster, keyspace, table & type) are displayed in a tabular format. - There is a drop-down menu on the top left corner to expand objects details. - On the top right menu is shown the Icon legend. - -
-
- Sometimes you want to be able to pass runtime query parameters to your statements.
- Those parameters are not part of the CQL specs and are specific to the interpreter.
- Below is the list of all parameters:
-
-
-
| Parameter | -Syntax | -Description | -
|---|---|---|
| Consistency Level | -@consistency=value | -Apply the given consistency level to all queries in the paragraph | -
| Serial Consistency Level | -@serialConsistency=value | -Apply the given serial consistency level to all queries in the paragraph | -
| Timestamp | -@timestamp=long value | -Apply the given timestamp to all queries in the paragraph. - Please note that timestamp value passed directly in CQL statement will override this value - |
-
| Retry Policy | -@retryPolicy=value | -Apply the given retry policy to all queries in the paragraph | -
| Fetch Size | -@fetchSize=int value | -Apply the given fetch size to all queries in the paragraph | -
| Parameter | -Possible Values | -
|---|---|
| Consistency Level | -ALL, ANY, ONE, TWO, THREE, QUORUM, LOCAL_ONE, LOCAL_QUORUM, EACH_QUORUM | -
| Serial Consistency Level | -SERIAL, LOCAL_SERIAL | -
| Timestamp | -Any long value | -
| Retry Policy | -- - DEFAULT, DOWNGRADING_CONSISTENCY, FALLTHROUGH, LOGGING_DEFAULT, - LOGGING_DOWNGRADING, LOGGING_FALLTHROUGH - - | -
| Fetch Size | -Any integer value | -
- - CREATE TABLE IF NOT EXISTS spark_demo.ts( - key int PRIMARY KEY, - value text - ); - TRUNCATE spark_demo.ts; - - # Timestamp in the past - @timestamp=10 - - # Force timestamp directly in the first insert - INSERT INTO spark_demo.ts(key,value) VALUES(1,'first insert') USING TIMESTAMP 100; - - # Select some data to make the clock turn - SELECT * FROM spark_demo.albums LIMIT 100; - - # Now insert using the timestamp parameter set at the beginning(10) - INSERT INTO spark_demo.ts(key,value) VALUES(1,'second insert'); - - # Check for the result. You should see 'first insert' - SELECT value FROM spark_demo.ts WHERE key=1; --
- For performance reason, it is better to prepare statements before-hand and reuse
- them later by providing bound values. This interpreter provides 3 commands to handle prepared and
- bound statements:
-
-
- - @prepare[statement_name]=... - - @bind[statement_name]=’text’, 1223, ’2015-07-30 12:00:01’, null, true, [‘list_item1’, ’list_item2’] - - @bind[statement_name_with_no_bound_value] - - @remove_prepare[statement_name] - --
- You can use the syntax "@prepare[statement_name]=SELECT ..." to create a prepared statement.
- The statement_name is mandatory because the interpreter prepares the given statement with the
- Java driver and saves the generated prepared statement in an internal map, using the provided
- statement_name as search key.
-
-
- - @prepare[select]=SELECT * FROM spark_demo.albums LIMIT ? - - @prepare[select]=SELECT * FROM spark_demo.artists LIMIT ? --
- Once the statement is prepared (possibly in a separated notebook/paragraph). You can bind values to it:
-
-
- - @bind[select_first]=10 --
- BEGIN BATCH - @bind[insert_user]='jdoe','John DOE' - UPDATE users SET age = 27 WHERE login='hsue'; - APPLY BATCH; --
- To avoid for a prepared statement to stay forever in the prepared statement map, you can use the @remove_prepare[statement_name] syntax - to remove it. Removing a non-existing prepared statement yields no error. -
-
- Instead of hard-coding your CQL queries, it is possible to use the mustache syntax ({{ }})
- to inject simple value or multiple choices forms.
-
-
- The syntax for simple parameter is: {{input_Label=default value}}.
- The default value is mandatory because the first time the paragraph is executed,
- we launch the CQL query before rendering the form so at least one value should be provided.
-
- The syntax for multiple choices parameter is: {{input_Label=value1 | value2 | … | valueN }}.
- By default the first choice is used for CQL query the first time the paragraph is executed.
-
- Example:
-
-
-
- #Secondary index on performer style
- SELECT name, country, performer
- FROM spark_demo.performers
- WHERE name='{{performer=Sheryl Crow|Doof|Fanfarlo|Los Paranoia}}'
- AND styles CONTAINS '{{style=Rock}}';
-
-
- | Parameter | -Default Value | -
|---|---|
| cassandra.cluster | -Test Cluster | -
| cassandra.compression.protocol | -NONE, possible values: LZ4, SNAPPY | -
| cassandra.credentials.password | -none | -
| cassandra.credentials.username | -none | -
| cassandra.hosts | -localhost | -
| cassandra.interpreter.parallelism | -10 | -
| cassandra.keyspace | -system | -
| cassandra.load.balancing.policy | -DEFAULT, or a FQCN of a custom class | -
| cassandra.max.schema.agreement.wait.second | -10 | -
| cassandra.native.port | -9042 | -
| cassandra.pooling.core.connection.per.host.local | -Protocol V2 and below: 2, V3 and above: 1 | -
| cassandra.pooling.core.connection.per.host.remote | -Protocol V2 and below: 1, V3 and above: 1 | -
| cassandra.pooling.heartbeat.interval.seconds | -30 | -
| cassandra.pooling.idle.timeout.seconds | -Test Cluster | -
| cassandra.pooling.max.connection.per.host.local | -Protocol V2 and below: 8, V3 and above: 1 | -
| cassandra.pooling.max.connection.per.host.remote | -Protocol V2 and below: 2, V3 and above: 1 | -
| cassandra.pooling.max.request.per.connection.local | -Protocol V2 and below: 128, V3 and above: 1024 | -
| cassandra.pooling.max.request.per.connection.remote | -Protocol V2 and below: 128, V3 and above: 256 | -
| cassandra.pooling.new.connection.threshold.local | -Protocol V2 and below: 100, V3 and above: 800 | -
| cassandra.pooling.new.connection.threshold.remote | -Protocol V2 and below: 100, V3 and above: 200 | -
| cassandra.pooling.pool.timeout.millisecs | -5000 | -
| cassandra.protocol.version | -3 | -
| cassandra.query.default.consistency | -ONE | -
| cassandra.query.default.fetchSize | -5000 | -
| cassandra.query.default.serial.consistency | -SERIAL | -
| cassandra.reconnection.policy | -DEFAULT, or a FQCN of a custom class | -
| cassandra.retry.policy | -DEFAULT, or a FQCN of a custom class | -
| cassandra.socket.connection.timeout.millisecs | -500 | -
| cassandra.socket.read.timeout.millisecs | -12000 | -
| cassandra.socket.tcp.no_delay | -true | -
| cassandra.speculative.execution.policy | -DEFAULT, or a FQCN of a custom class | -
This interpreter is compatible with any CQL statement supported by Cassandra. Ex:
INSERT INTO users(login,name) VALUES('jdoe','John DOE');SELECT * FROM users WHERE login='jdoe';USE spark_demo;SELECT * FROM albums_by_country LIMIT 1; SELECT * FROM countries LIMIT 1;SELECT *FROM artistsWHERE login='jlennon';
BEGIN BATCHINSERT INTO users(login,name) VALUES('jdoe','John DOE');INSERT INTO users_preferences(login,account_type) VALUES('jdoe','BASIC');APPLY BATCH;CREATE TABLE IF NOT EXISTS test(key int PRIMARY KEY,value text);INSERT INTO users(login,name) VALUES('jdoe','John DOE');Insert into users(login,name) vAlues('hsue','Helen SUE');| Cassandra version | Documentation |
|---|---|
| 2.2 | http://docs.datastax.com/en/cql/3.3/cql/cqlIntro.html |
| 2.1 & 2.0 | http://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html |
| 1.2 | http://docs.datastax.com/en/cql/3.0/cql/aboutCQL.html |
It is possible to add comments between statements. Single line comments start with thehash sign (#) or double slashes (//). Multi-line comments are enclosed between/** and **/. Ex:
#Single line comment style 1INSERT INTO users(login,name) VALUES('jdoe','John DOE');//Single line comment style 2/**Multi linecomments**/Insert into users(login,name) vAlues('hsue','Helen SUE');The interpreters is shipped with a built-in syntax validator. This validator onlychecks for basic syntax errors. All CQL-related syntax validation is delegateddirectly to Cassandra
Most of the time, syntax errors are due to missing semi-colons between statements or typo errors.
To make schema discovery easier and more interactive, the following commands are supported:
| Command | Description |
|---|---|
| DESCRIBE CLUSTER; | Show the current cluster name and its partitioner |
| DESCRIBE KEYSPACES; | List all existing keyspaces in the cluster and their configuration(replication factor, durable write ...) |
| DESCRIBE TABLES; | List all existing keyspaces in the cluster and for each, all the tables name |
| DESCRIBE TYPES; | List all existing keyspaces in the cluster and for each, all the types name |
| DESCRIBE FUNCTIONS; | List all existing keyspaces in the cluster and for each, all the functions name and arguments |
| DESCRIBE AGGREGATES; | List all existing keyspaces in the cluster and for each, all the aggregates name and arguments |
| DESCRIBE MATERIALIZED VIEWS; | List all existing keyspaces in the cluster and for each, all the materialized view name |
| DESCRIBE KEYSPACE <keyspace name>; | Describe the given keyspace configuration and all its table details (name, columns, ...) |
| DESCRIBE TABLE (<keyspace name>).<table name>; | Describe the given table. If the keyspace is not provided, the currentlogged in keyspace is used. If there is no logged in keyspace,the default system keyspace is used. If no table is found, an error message is raised |
| DESCRIBE TYPE (<keyspace name>).<type name>; | Describe the given type(UDT). If the keyspace is not provided, the currentlogged in keyspace is used. If there is no logged in keyspace,the default system keyspace is used. If no type is found, an error message is raised |
| DESCRIBE FUNCTION (<keyspace name>).<function name>; | Describe the given function. If the keyspace is not provided, the currentlogged in keyspace is used. If there is no logged in keyspace,the default system keyspace is used. If no function is found, an error message is raised |
| DESCRIBE AGGREGATE (<keyspace name>).<aggregate name>; | Describe the given aggregate. If the keyspace is not provided, the currentlogged in keyspace is used. If there is no logged in keyspace,the default system keyspace is used. If no aggregate is found, an error message is raised |
| DESCRIBE MATERIALIZED VIEW (<keyspace name>).<view name>; | Describe the given materialized view. If the keyspace is not provided, the currentlogged in keyspace is used. If there is no logged in keyspace,the default system keyspace is used. If no materialized view is found, an error message is raised |
The schema objects (cluster, keyspace, table, type, view, function & aggregate) are displayed in a tabular format. There is a drop-down menu on the top left corner to expand objects details. On the top right menu is shown the Icon legend.
Sometimes you want to be able to pass runtime query parameters to your statements.Those parameters are not part of the CQL specs and are specific to the interpreter.Below is the list of all parameters:
| Parameter | Syntax | Description |
|---|---|---|
| Consistency Level | @consistency=value | Apply the given consistency level to all queries in the paragraph |
| Serial Consistency Level | @serialConsistency=value | Apply the given serial consistency level to all queries in the paragraph |
| Timestamp | @timestamp=long value | Apply the given timestamp to all queries in the paragraph. Please note that timestamp value passed directly in CQL statement will override this value |
| Retry Policy | @retryPolicy=value | Apply the given retry policy to all queries in the paragraph |
| Fetch Size | @fetchSize=int value | Apply the given fetch size to all queries in the paragraph |
| Parameter | Possible Values |
|---|---|
| Consistency Level | ALL, ANY, ONE, TWO, THREE, QUORUM, LOCAL_ONE, LOCAL_QUORUM, EACH_QUORUM |
| Serial Consistency Level | SERIAL, LOCAL_SERIAL |
| Timestamp | Any long value |
| Retry Policy | DEFAULT, DOWNGRADING_CONSISTENCY, FALLTHROUGH, LOGGING_DEFAULT,LOGGING_DOWNGRADING, LOGGING_FALLTHROUGH |
| Fetch Size | Any integer value |
CREATE TABLE IF NOT EXISTS spark_demo.ts(key int PRIMARY KEY,value text);TRUNCATE spark_demo.ts;# Timestamp in the past@timestamp=10# Force timestamp directly in the first insertINSERT INTO spark_demo.ts(key,value) VALUES(1,'first insert') USING TIMESTAMP 100;# Select some data to make the clock turnSELECT * FROM spark_demo.albums LIMIT 100;# Now insert using the timestamp parameter set at the beginning(10)INSERT INTO spark_demo.ts(key,value) VALUES(1,'second insert');# Check for the result. You should see 'first insert'SELECT value FROM spark_demo.ts WHERE key=1;
For performance reason, it is better to prepare statements before-hand and reusethem later by providing bound values. This interpreter provides 3 commands to handle prepared andbound statements:
@prepare[statement_name]=...@bind[statement_name]=’text’, 1223, ’2015-07-30 12:00:01’, null, true, [‘list_item1’, ’list_item2’]@bind[statement_name_with_no_bound_value]@remove_prepare[statement_name]
You can use the syntax "@prepare[statement_name]=SELECT ..." to create a prepared statement.The statement_name is mandatory because the interpreter prepares the given statement with theJava driver and saves the generated prepared statement in an internal map, using the providedstatement_name as search key.
@prepare[select]=SELECT * FROM spark_demo.albums LIMIT ?@prepare[select]=SELECT * FROM spark_demo.artists LIMIT ?
Once the statement is prepared (possibly in a separated notebook/paragraph). You can bind values to it:
@bind[select_first]=10
BEGIN BATCH@bind[insert_user]='jdoe','John DOE'UPDATE users SET age = 27 WHERE login='hsue';APPLY BATCH;
To avoid for a prepared statement to stay forever in the prepared statement map, you can use the @remove_prepare[statement_name] syntaxto remove it. Removing a non-existing prepared statement yields no error.
Instead of hard-coding your CQL queries, it is possible to use the mustache syntax ({{ }})to inject simple value or multiple choices forms.
The syntax for simple parameter is: {{input_Label=default value}}.The default value is mandatory because the first time the paragraph is executed,we launch the CQL query before rendering the form so at least one value should be provided.
The syntax for multiple choices parameter is: {{input_Label=value1 | value2 | … | valueN }}.By default the first choice is used for CQL query the first time the paragraph is executed.
Example:
#Secondary index on performer styleSELECT name, country, performerFROM spark_demo.performersWHERE name='{{performer=Sheryl Crow|Doof|Fanfarlo|Los Paranoia}}'AND styles CONTAINS '{{style=Rock}}';| Parameter | Default Value |
|---|---|
| cassandra.cluster | Test Cluster |
| cassandra.compression.protocol | NONE, possible values: LZ4, SNAPPY |
| cassandra.credentials.password | none |
| cassandra.credentials.username | none |
| cassandra.hosts | localhost |
| cassandra.interpreter.parallelism | 10 |
| cassandra.keyspace | system |
| cassandra.load.balancing.policy | DEFAULT, or a FQCN of a custom class |
| cassandra.max.schema.agreement.wait.second | 10 |
| cassandra.native.port | 9042 |
| cassandra.pooling.core.connection.per.host.local | Protocol V2 and below: 2, V3 and above: 1 |
| cassandra.pooling.core.connection.per.host.remote | Protocol V2 and below: 1, V3 and above: 1 |
| cassandra.pooling.heartbeat.interval.seconds | 30 |
| cassandra.pooling.idle.timeout.seconds | Test Cluster |
| cassandra.pooling.max.connection.per.host.local | Protocol V2 and below: 8, V3 and above: 1 |
| cassandra.pooling.max.connection.per.host.remote | Protocol V2 and below: 2, V3 and above: 1 |
| cassandra.pooling.max.request.per.connection.local | Protocol V2 and below: 128, V3 and above: 1024 |
| cassandra.pooling.max.request.per.connection.remote | Protocol V2 and below: 128, V3 and above: 256 |
| cassandra.pooling.new.connection.threshold.local | Protocol V2 and below: 100, V3 and above: 800 |
| cassandra.pooling.new.connection.threshold.remote | Protocol V2 and below: 100, V3 and above: 200 |
| cassandra.pooling.pool.timeout.millisecs | 5000 |
| cassandra.protocol.version | 3 |
| cassandra.query.default.consistency | ONE |
| cassandra.query.default.fetchSize | 5000 |
| cassandra.query.default.serial.consistency | SERIAL |
| cassandra.reconnection.policy | DEFAULT, or a FQCN of a custom class |
| cassandra.retry.policy | DEFAULT, or a FQCN of a custom class |
| cassandra.socket.connection.timeout.millisecs | 500 |
| cassandra.socket.read.timeout.millisecs | 12000 |
| cassandra.socket.tcp.no_delay | true |
| cassandra.speculative.execution.policy | DEFAULT, or a FQCN of a custom class |