mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-25 18:20:33 -06:00
add example files from grammar
This commit is contained in:
parent
1403e8ff0f
commit
2694af32c8
@ -0,0 +1,6 @@
|
||||
ALTER KEYSPACE cycling
|
||||
WITH REPLICATION = {
|
||||
'class' : 'NetworkTopologyStrategy',
|
||||
'datacenter1' : 3 }
|
||||
AND DURABLE_WRITES = false ;
|
||||
|
@ -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;
|
@ -0,0 +1 @@
|
||||
ALTER ROLE coach WITH PASSWORD='bestTeam';
|
@ -0,0 +1,5 @@
|
||||
ALTER TABLE cycling_comments
|
||||
WITH compression = {
|
||||
'sstable_compression' : 'DeflateCompressor',
|
||||
'chunk_length_kb' : 64 };
|
||||
|
@ -0,0 +1,4 @@
|
||||
ALTER TYPE cycling.fullname
|
||||
RENAME middlename TO middle
|
||||
AND lastname to last
|
||||
AND firstname to first;
|
@ -0,0 +1 @@
|
||||
ALTER USER moss WITH PASSWORD 'bestReceiver';
|
@ -0,0 +1 @@
|
||||
APPLY BATCH;
|
@ -0,0 +1,5 @@
|
||||
CREATE AGGREGATE cycling.average(int)
|
||||
SFUNC avgState
|
||||
STYPE tuple<int,bigint>
|
||||
FINALFUNC avgFinal
|
||||
INITCOND (0,0);
|
@ -0,0 +1,10 @@
|
||||
CREATE OR REPLACE FUNCTION cycling.avgFinal ( state tuple<int,bigint> )
|
||||
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); $$
|
||||
;
|
@ -0,0 +1,4 @@
|
||||
CREATE INDEX user_state
|
||||
ON myschema.users (state);
|
||||
|
||||
CREATE INDEX ON myschema.users (zip);
|
@ -0,0 +1,6 @@
|
||||
CREATE KEYSPACE cycling
|
||||
WITH REPLICATION = {
|
||||
'class' : 'SimpleStrategy',
|
||||
'replication_factor' : 1
|
||||
};
|
||||
|
@ -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' ;
|
@ -0,0 +1,3 @@
|
||||
CREATE ROLE coach
|
||||
WITH PASSWORD = 'All4One2day!'
|
||||
AND LOGIN = true;
|
@ -0,0 +1,5 @@
|
||||
CREATE TABLE cycling.race_winners (
|
||||
race_name text,
|
||||
race_position int,
|
||||
cyclist_name FROZEN<fullname>,
|
||||
PRIMARY KEY (race_name, race_position));
|
@ -0,0 +1 @@
|
||||
DROP TRIGGER trigger_name ON table_name;
|
@ -0,0 +1,6 @@
|
||||
CREATE TYPE cycling.basic_info (
|
||||
birthday timestamp,
|
||||
nationality text,
|
||||
weight text,
|
||||
height text
|
||||
);
|
@ -0,0 +1 @@
|
||||
CREATE USER newuser WITH PASSWORD 'password';
|
@ -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;
|
@ -0,0 +1 @@
|
||||
DROP AGGREGATE IF EXISTS cycling.avgState;
|
@ -0,0 +1 @@
|
||||
DROP FUNCTION IF EXISTS cycling.fLog;
|
@ -0,0 +1 @@
|
||||
DROP INDEX cycling.ryear;
|
@ -0,0 +1 @@
|
||||
DROP KEYSPACE cycling;
|
@ -0,0 +1 @@
|
||||
DROP MATERIALIZED VIEW cycling.cyclist_by_age;
|
@ -0,0 +1 @@
|
||||
DROP ROLE IF EXISTS team_manager;
|
@ -0,0 +1 @@
|
||||
DROP TABLE cycling.cyclist_name;
|
@ -0,0 +1 @@
|
||||
DROP TRIGGER trigger_name ON ks.table_name;
|
@ -0,0 +1 @@
|
||||
DROP TYPE cycling.basic_info ;
|
@ -0,0 +1 @@
|
||||
DROP USER IF EXISTS boone;
|
10
driver-cql-shaded/src/main/resources/cql3_examples/grant.cql
Normal file
10
driver-cql-shaded/src/main/resources/cql3_examples/grant.cql
Normal file
@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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);
|
@ -0,0 +1,5 @@
|
||||
LIST ALL
|
||||
OF coach;
|
||||
LIST ALL;
|
||||
LIST ALL
|
||||
ON cyclist.name;
|
@ -0,0 +1,3 @@
|
||||
LIST ROLES;
|
||||
LIST ROLES
|
||||
OF manager;
|
@ -0,0 +1,6 @@
|
||||
REVOKE SELECT
|
||||
ON cycling.name
|
||||
FROM manager;
|
||||
REVOKE ALTER
|
||||
ON ALL ROLES
|
||||
FROM coach;
|
@ -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';
|
||||
|
@ -0,0 +1,2 @@
|
||||
TRUNCATE cycling.user_activity;
|
||||
TRUNCATE TABLE cycling.user_activity;
|
@ -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;
|
@ -0,0 +1,3 @@
|
||||
USE key_name;
|
||||
USE PortfolioDemo;
|
||||
USE "Excalibur";
|
Loading…
Reference in New Issue
Block a user