diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterKeyspace.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterKeyspace.cql new file mode 100644 index 000000000..93f7780b8 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterKeyspace.cql @@ -0,0 +1,6 @@ +ALTER KEYSPACE cycling +WITH REPLICATION = { + 'class' : 'NetworkTopologyStrategy', + 'datacenter1' : 3 } + AND DURABLE_WRITES = false ; + \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterMaterializedView.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterMaterializedView.cql new file mode 100644 index 000000000..539e7553a --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterMaterializedView.cql @@ -0,0 +1,3 @@ +ALTER MATERIALIZED VIEW cycling.cyclist_by_age +WITH comment = 'A most excellent and useful view' +AND bloom_filter_fp_chance = 0.02; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterRole.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterRole.cql new file mode 100644 index 000000000..b20186039 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterRole.cql @@ -0,0 +1 @@ +ALTER ROLE coach WITH PASSWORD='bestTeam'; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterTable.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterTable.cql new file mode 100644 index 000000000..85bbe5fb1 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterTable.cql @@ -0,0 +1,5 @@ +ALTER TABLE cycling_comments +WITH compression = { + 'sstable_compression' : 'DeflateCompressor', + 'chunk_length_kb' : 64 }; + diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterType.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterType.cql new file mode 100644 index 000000000..ae99ca5ee --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterType.cql @@ -0,0 +1,4 @@ +ALTER TYPE cycling.fullname +RENAME middlename TO middle +AND lastname to last +AND firstname to first; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/alterUser.cql b/driver-cql-shaded/src/main/resources/cql3_examples/alterUser.cql new file mode 100644 index 000000000..c2e8eaf09 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/alterUser.cql @@ -0,0 +1 @@ +ALTER USER moss WITH PASSWORD 'bestReceiver'; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/applyBatch.cql b/driver-cql-shaded/src/main/resources/cql3_examples/applyBatch.cql new file mode 100644 index 000000000..189b6014f --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/applyBatch.cql @@ -0,0 +1 @@ +APPLY BATCH; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createAggregate.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createAggregate.cql new file mode 100644 index 000000000..31ee5d439 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createAggregate.cql @@ -0,0 +1,5 @@ +CREATE AGGREGATE cycling.average(int) +SFUNC avgState +STYPE tuple +FINALFUNC avgFinal +INITCOND (0,0); \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createFunction.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createFunction.cql new file mode 100644 index 000000000..c7699de0e --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createFunction.cql @@ -0,0 +1,10 @@ +CREATE OR REPLACE FUNCTION cycling.avgFinal ( state tuple ) +CALLED ON NULL INPUT +RETURNS double +LANGUAGE java AS + $$ double r = 0; + if (state.getInt(0) == 0) return null; + r = state.getLong(1); + r/= state.getInt(0); + return Double.valueOf(r); $$ +; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createIndex.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createIndex.cql new file mode 100644 index 000000000..eaf745b5d --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createIndex.cql @@ -0,0 +1,4 @@ + CREATE INDEX user_state + ON myschema.users (state); + +CREATE INDEX ON myschema.users (zip); \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createKeyspace.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createKeyspace.cql new file mode 100644 index 000000000..759cba23f --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createKeyspace.cql @@ -0,0 +1,6 @@ +CREATE KEYSPACE cycling + WITH REPLICATION = { + 'class' : 'SimpleStrategy', + 'replication_factor' : 1 + }; + \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createMaterializedView.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createMaterializedView.cql new file mode 100644 index 000000000..b4d16200e --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createMaterializedView.cql @@ -0,0 +1,7 @@ +CREATE MATERIALIZED VIEW cycling.cyclist_by_age +AS SELECT age, name, country +FROM cycling.cyclist_mv +WHERE age IS NOT NULL AND cid IS NOT NULL +PRIMARY KEY (age, cid) +WITH caching = { 'keys' : 'ALL', 'rows_per_partition' : '100' } + AND comment = 'Based on table cyclist' ; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createRole.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createRole.cql new file mode 100644 index 000000000..590783c19 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createRole.cql @@ -0,0 +1,3 @@ +CREATE ROLE coach +WITH PASSWORD = 'All4One2day!' +AND LOGIN = true; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createTable.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createTable.cql new file mode 100644 index 000000000..ab98b7cf5 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createTable.cql @@ -0,0 +1,5 @@ +CREATE TABLE cycling.race_winners ( + race_name text, + race_position int, + cyclist_name FROZEN, + PRIMARY KEY (race_name, race_position)); diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createTrigger.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createTrigger.cql new file mode 100644 index 000000000..af59c5f2d --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createTrigger.cql @@ -0,0 +1 @@ +DROP TRIGGER trigger_name ON table_name; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createType.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createType.cql new file mode 100644 index 000000000..013792591 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createType.cql @@ -0,0 +1,6 @@ +CREATE TYPE cycling.basic_info ( + birthday timestamp, + nationality text, + weight text, + height text +); \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/createUser.cql b/driver-cql-shaded/src/main/resources/cql3_examples/createUser.cql new file mode 100644 index 000000000..b6c6af3c5 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/createUser.cql @@ -0,0 +1 @@ +CREATE USER newuser WITH PASSWORD 'password'; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/delete.cql b/driver-cql-shaded/src/main/resources/cql3_examples/delete.cql new file mode 100644 index 000000000..8345ac58b --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/delete.cql @@ -0,0 +1,8 @@ +DELETE firstname, lastname FROM cycling.cyclist_name +WHERE id = e7ae5cf3-d358-4d99-b900-85902fda9bb0; +DELETE FROM cycling.cyclist_name +WHERE id =e7ae5cf3-d358-4d99-b900-85902fda9bb0 +if firstname='Alex' and lastname='Smith'; +DELETE id FROM cyclist_id +WHERE lastname = 'WELTEN' and firstname = 'Bram' +IF EXISTS; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropAggregate.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropAggregate.cql new file mode 100644 index 000000000..0392a206c --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropAggregate.cql @@ -0,0 +1 @@ +DROP AGGREGATE IF EXISTS cycling.avgState; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropFunction.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropFunction.cql new file mode 100644 index 000000000..93605fc17 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropFunction.cql @@ -0,0 +1 @@ +DROP FUNCTION IF EXISTS cycling.fLog; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropIndex.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropIndex.cql new file mode 100644 index 000000000..7a44cada0 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropIndex.cql @@ -0,0 +1 @@ +DROP INDEX cycling.ryear; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropKeyspace.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropKeyspace.cql new file mode 100644 index 000000000..e86c66c54 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropKeyspace.cql @@ -0,0 +1 @@ +DROP KEYSPACE cycling; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropMaterializedView.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropMaterializedView.cql new file mode 100644 index 000000000..9ad58b087 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropMaterializedView.cql @@ -0,0 +1 @@ +DROP MATERIALIZED VIEW cycling.cyclist_by_age; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropRole.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropRole.cql new file mode 100644 index 000000000..9c48b1d0a --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropRole.cql @@ -0,0 +1 @@ +DROP ROLE IF EXISTS team_manager; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropTable.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropTable.cql new file mode 100644 index 000000000..49059e647 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropTable.cql @@ -0,0 +1 @@ +DROP TABLE cycling.cyclist_name; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropTrigger.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropTrigger.cql new file mode 100644 index 000000000..df0595733 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropTrigger.cql @@ -0,0 +1 @@ +DROP TRIGGER trigger_name ON ks.table_name; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropType.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropType.cql new file mode 100644 index 000000000..931272c8e --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropType.cql @@ -0,0 +1 @@ +DROP TYPE cycling.basic_info ; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/dropUser.cql b/driver-cql-shaded/src/main/resources/cql3_examples/dropUser.cql new file mode 100644 index 000000000..26a82e695 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/dropUser.cql @@ -0,0 +1 @@ +DROP USER IF EXISTS boone; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/grant.cql b/driver-cql-shaded/src/main/resources/cql3_examples/grant.cql new file mode 100644 index 000000000..9f1f01548 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/grant.cql @@ -0,0 +1,10 @@ +GRANT SELECT ON ALL KEYSPACES TO coach; +GRANT MODIFY ON KEYSPACE field TO manager; +GRANT ALTER ON KEYSPACE cycling TO coach; +GRANT ALL PERMISSIONS ON cycling.name TO coach; +GRANT ALL ON KEYSPACE cycling TO cycling_admin; + + + + + diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/insert.cql b/driver-cql-shaded/src/main/resources/cql3_examples/insert.cql new file mode 100644 index 000000000..f237ff495 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/insert.cql @@ -0,0 +1,21 @@ +INSERT INTO cycling.cyclist_name (id, lastname, firstname) + VALUES (6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47, 'KRUIKSWIJK','Steven') + USING TTL 86400 AND TIMESTAMP 123456789; + + + INSERT INTO cycling.cyclist_categories (id,lastname,categories) + VALUES( + '6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47', + 'KRUIJSWIJK', + {'GC', 'Time-trial', 'Sprint'}); + +INSERT INTO cycling.cyclist_categories JSON + '{"category": "", "points":780, "id": "6ab09bec-e68e-48d9-a5f8-97e6fb4c9b47"}'; + +INSERT INTO cycling.cyclist_teams (id,lastname,teams) + VALUES(5b6962dd-3f90-4c93-8f61-eabfa4a803e2,'VOS',$$Women's Tour of New Zealand$$); + +INSERT INTO cycling.route(race_id,race_name,lat_long) VALUES (500, 'Name', ('Champagne', (46.833,6.65))); + +INSERT INTO "students"("id", "address", "name", "[age]", "age", "colu'mn1", "colu68mn1", "height") values + (740, 'hongkong','alice',null,32,'','',172); \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/listPermissions.cql b/driver-cql-shaded/src/main/resources/cql3_examples/listPermissions.cql new file mode 100644 index 000000000..b0269b35c --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/listPermissions.cql @@ -0,0 +1,5 @@ +LIST ALL +OF coach; +LIST ALL; +LIST ALL +ON cyclist.name; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/listRoles.cql b/driver-cql-shaded/src/main/resources/cql3_examples/listRoles.cql new file mode 100644 index 000000000..0e0f71290 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/listRoles.cql @@ -0,0 +1,3 @@ +LIST ROLES; +LIST ROLES +OF manager; diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/revoke.cql b/driver-cql-shaded/src/main/resources/cql3_examples/revoke.cql new file mode 100644 index 000000000..fdd3b4b82 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/revoke.cql @@ -0,0 +1,6 @@ +REVOKE SELECT +ON cycling.name +FROM manager; +REVOKE ALTER +ON ALL ROLES +FROM coach; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/select.cql b/driver-cql-shaded/src/main/resources/cql3_examples/select.cql new file mode 100644 index 000000000..11d24922a --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/select.cql @@ -0,0 +1,41 @@ +SELECT event_id, + dateOf(created_at) AS creation_date, + blobAsText(content) AS content + FROM timeline; + + SELECT COUNT(*) +FROM system.IndexInfo; + +SELECT lastname +FROM cycling.cyclist_name +LIMIT 50000; + +SELECT id, lastname, teams +FROM cycling.cyclist_career_teams +WHERE id=5b6962dd-3f90-4c93-8f61-eabfa4a803e2; + + +SELECT * FROM cycling.cyclist_category; + +SELECT * FROM cycling.cyclist_category WHERE category = 'SPRINT'; + +SELECT category, points, lastname FROM cycling.cyclist_category; + +SELECT * From cycling.cyclist_name LIMIT 3; + +SELECT * FROM cycling.cyclist_cat_pts WHERE category = 'GC' ORDER BY points ASC; + +SELECT race_name, point_id, lat_long AS CITY_LATITUDE_LONGITUDE FROM cycling.route; + +SELECT * FROM cycling.upcoming_calendar WHERE year = 2015 AND month = 06; + +select json name, checkin_id, time_stamp from checkin; + +select name, checkin_id, toJson(time_stamp) from checkin; + +SELECT * FROM cycling.calendar WHERE race_id IN (100, 101, 102) AND (race_start_date, race_end_date) IN (('2015-01-01','2015-02-02'), ('2016-01-01','2016-02-02')); + +SELECT * FROM cycling.calendar WHERE race_id IN (100, 101, 102) AND (race_start, race_end) >= ('2015-01-01', '2015-02-02'); + +SELECT * FROM cycling.race_times WHERE race_name = '17th Santos Tour Down Under' and race_time >= '19:15:19' AND race_time <= '19:15:39'; + diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/truncate.cql b/driver-cql-shaded/src/main/resources/cql3_examples/truncate.cql new file mode 100644 index 000000000..5cd74667c --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/truncate.cql @@ -0,0 +1,2 @@ +TRUNCATE cycling.user_activity; +TRUNCATE TABLE cycling.user_activity; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/update.cql b/driver-cql-shaded/src/main/resources/cql3_examples/update.cql new file mode 100644 index 000000000..ff06f88f8 --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/update.cql @@ -0,0 +1,29 @@ + UPDATE cycling.cyclist_name + SET comments ='Rides hard, gets along with others, a real winner' + WHERE id = fb372533-eb95-4bb4-8685-6ef61e994caa IF EXISTS; + + UPDATE cycling.cyclists + SET firstname = 'Marianne', + lastname = 'VOS' + WHERE id = 88b8fd18-b1ed-4e96-bf79-4280797cba80; + UPDATE cycling.cyclists + SET firstname = 'Anna', lastname = 'VAN DER BREGGEN' WHERE id = e7cd5752-bc0d-4157-a80f-7523add8dbcd; + + + UPDATE cycling.upcoming_calendar + SET events = ['Tour de France'] + events WHERE year=2015 AND month=06; + + + + UPDATE users + SET state = 'TX' + WHERE user_uuid + IN (88b8fd18-b1ed-4e96-bf79-4280797cba80, + 06a8913c-c0d6-477c-937d-6c1b69a95d43, + bc108776-7cb5-477f-917d-869c12dfffa8); + + UPDATE cyclist.cyclist_career_teams SET teams = teams + {'Team DSB - Ballast Nedam'} WHERE id = 88b8fd18-b1ed-4e96-bf79-4280797cba80; + + UPDATE cyclist.cyclist_career_teams SET teams = teams - {'WOMBATS'} WHERE id = 88b8fd18-b1ed-4e96-bf79-4280797cba80; + + UPDATE cyclist.cyclist_career_teams SET teams = {} WHERE id = 88b8fd18-b1ed-4e96-bf79-4280797cba80; \ No newline at end of file diff --git a/driver-cql-shaded/src/main/resources/cql3_examples/use.cql b/driver-cql-shaded/src/main/resources/cql3_examples/use.cql new file mode 100644 index 000000000..8c066c96c --- /dev/null +++ b/driver-cql-shaded/src/main/resources/cql3_examples/use.cql @@ -0,0 +1,3 @@ +USE key_name; +USE PortfolioDemo; +USE "Excalibur";