This repository has been archived by the owner on May 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
/
test-users-create.cql
90 lines (85 loc) · 6.77 KB
/
test-users-create.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
-- Create keyspace
CREATE KEYSPACE IF NOT EXISTS test
WITH REPLICATION = {
'class' : 'SimpleStrategy',
'replication_factor': 1
};
USE test;
-- Create table
CREATE TABLE IF NOT EXISTS test.users (
name varchar,
gender varchar,
animal varchar,
age int,
food varchar,
latitude float,
longitude float,
number int,
bool boolean,
phrase text,
date text,
start_date text,
stop_date text,
setz set<text>,
listz list<text>,
mapz map<text, text>,
PRIMARY KEY ((name, gender), animal, age)
);
-- Create index
CREATE CUSTOM INDEX IF NOT EXISTS users_index
ON test.users ()
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds' : '60',
'ram_buffer_mb' : '64',
'max_merge_mb' : '5',
'max_cached_mb' : '30',
'excluded_data_centers' : 'dc2,dc3',
'schema' : '{
analyzers : {
my_custom_analyzer : {
type : "snowball",
language : "Spanish",
stopwords : "el,la,lo,loas,las,a,ante,bajo,cabe,con,contra"
}
},
default_analyzer : "english",
fields : {
name : {type : "string"},
gender : {type : "string", validated : true},
animal : {type : "string"},
age : {type : "integer"},
food : {type : "string"},
number : {type : "integer"},
bool : {type : "boolean"},
date : {type : "date", validated : true, pattern : "yyyy/MM/dd"},
duration : {type : "date_range", from : "start_date", to : "stop_date", pattern : "yyyy/MM/dd"},
place : {type : "geo_point", latitude : "latitude", longitude : "longitude"},
mapz : {type : "string"},
setz : {type : "string"},
listz : {type : "string"},
phrase : {type : "text", analyzer : "my_custom_analyzer"}
}
}'
};
-- populate table
INSERT INTO test.users (name, gender, age, animal, food, number, bool, setz, listz, mapz, start_date, stop_date, latitude, longitude) VALUES ( 'Joe', 'male', -2, 'monkey', 'chips', 1, true, {'s1', 's2'}, ['l1', 'l2'], {'k1':'v1','k2':'v2'}, '2014/01/01','2014/01/31',-87.8, 0.5);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, setz, listz, mapz, start_date, stop_date, latitude, longitude) VALUES ( 'Joe', 'male', 1, 'monkey', 'chips', 2, true, {'s1', 's2'}, ['l1', 'l2'], {'k1':'v1','k2':'v2'}, '2014/02/01','2014/02/28',45.8, 0.5);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, setz, listz, mapz, start_date, stop_date, latitude, longitude) VALUES ( 'James', 'male', 1, 'monkey', 'chips', 3, true, {'s1', 's2'}, ['l1', 'l2'], {'k1':'v1','k2':'v2'}, '2014/03/01','2014/03/31',2.38, -170.6);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, setz, listz, mapz, start_date, stop_date, latitude, longitude) VALUES ( 'James', 'male', 2, 'monkey', 'chips', 4, true, {'s1', 's3'}, ['l1', 'l2'], {'k1':'v1'}, '2014/04/01','2014/04/30',88.9, -156.8);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, setz, listz, mapz, start_date, stop_date, latitude, longitude) VALUES ( 'Jane', 'female', -2, 'monkey', 'chips', 5, true, {'s3', 's4'}, ['l1', 'l3'], {'k3':'v3','k2':'v2'}, '2014/05/01','2014/05/31',1.45, 94.23);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, date, start_date, stop_date, latitude, longitude) VALUES ( 'Jane', 'female', -1, 'monkey', 'chips', 6, true, '2014/01/01', '2014/06/01','2014/06/30',-42.8, 12.4);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, date, start_date, stop_date, latitude, longitude) VALUES ( 'James', 'male', 0, 'monkey', 'chips', 7, true, '2014/01/02', '2014/07/01','2014/07/31',-12, 13.6);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, date, start_date, stop_date, latitude, longitude) VALUES ( 'Jane', 'female', 1, 'monkey', 'chips', 8, true, '2010/01/01', '2014/08/01','2014/08/31',-5.6, 34.6);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', 2, 'monkey', 'chips', 9, true, '2014/09/01','2014/09/30',-32.3, -170.0);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'Joe', 'male', 2, 'monkey', 'chips', 10, false, '2014/10/01','2014/10/31',-32.8, 115.6);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'James', 'male', -2, 'monkey', 'chips', 11, false, '2014/11/01','2014/11/30',-21.4, 32.7);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'James', 'male', -1, 'monkey', 'chips', 12, false, '2014/12/01','2014/12/31',-33.2, 167.0);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', 0, 'monkey', 'chips', 13, false, '2014/01/01','2014/06/30',65.5, 2.3);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, start_date, stop_date, latitude, longitude) VALUES ( 'Joe', 'male', -1, 'monkey', 'chips', 14, false, '2014/02/01','2014/07/31',-22.1, 180.0);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Joe', 'male', 0, 'monkey', 'chips', 15, false, 'Ligero como una pluma', '2014/03/01','2014/08/31',-35.4, 97.4);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', -2, 'monkey', 'chips', 16, false, 'Rápido como un puma', '2014/04/01','2014/09/30',0.7, -167);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', -1, 'monkey', 'chips', 17, false, 'Una mancha en la camisa morada', '2014/05/01','2014/10/31',-42.3, 25.5);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Jane', 'female', 0, 'monkey', 'turkey', 18, false, 'Sopa de tortuga', '2014/06/01','2014/11/30',-12.8, 176);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', 1, 'monkey', 'tuna', 19, false, 'En un lugar de la Mancha', '2014/07/01','2014/12/31',-0.5, 1.2);
INSERT INTO test.users (name, gender, age, animal, food, number, bool, phrase, start_date, stop_date, latitude, longitude) VALUES ( 'Alicia', 'female', 2, 'monkey', 'fish', 20, false, 'Una mancha en la camisa manchada', '2014/01/01','2014/12/31',-76.6,5.4);