Skip to content

Commit

Permalink
Merge pull request #21 from dataux/20_cassandra
Browse files Browse the repository at this point in the history
Cassandra data source part 1
  • Loading branch information
araddon authored Aug 14, 2016
2 parents 60825e9 + d2c368a commit 2fae98a
Show file tree
Hide file tree
Showing 20 changed files with 1,965 additions and 101 deletions.
8 changes: 6 additions & 2 deletions GLOCKFILE
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ github.com/coreos/etcd 207c92b62785d220edc74ed791fd8a22a18e378e
github.com/coreos/go-etcd de3514f25635bbfb024fdaf2a8d5f67378492675
github.com/dchest/siphash 6d8617816bb5d8268011ffbfb8720f17ce9af63c
github.com/go-sql-driver/mysql 0b58b37b664c21f3010e836f1b931e1d0b0b0685
github.com/gocql/gocql b2caded3d0f457e42515c06d4092c02055cebaa0
github.com/gogo/protobuf a4cceea7a401a73fefafd1a21fedbd4694124a82
github.com/golang/protobuf c3cefd437628a0b7d31b34fe44b3a7a540e98527
github.com/golang/snappy d9eb7a3d35ec988b8585d4a0068e462c27d28380
github.com/google/btree 7d79101e329e5a3adf994758c578dab82b90c017
github.com/hailocab/go-hostpool e80d13ce29ede4452c43dea11e79b9bc8a15b478
github.com/hashicorp/go-immutable-radix afc5a0dbb18abdf82c277a7bc01533e81fa1d6b8
github.com/hashicorp/go-memdb 98f52f52d7a476958fa9da671354d270c50661a7
github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
Expand All @@ -27,9 +30,9 @@ github.com/lytics/metafora eb26f00432a98228e44de8e074b9627fc4c1e457
github.com/lytics/sereno f6128b640de0742892a439b3672ac88637df977d
github.com/mattbaird/elastigo 34c4c4d8425cbdcbc8e257943a2044d5e9f7dab5
github.com/mb0/glob 1eb79d2de6c448664e7272f8b9fe1938239e3aaa
github.com/nats-io/gnatsd 86e883ce7d54d925e3018a761da38074eb732218
github.com/nats-io/gnatsd 5e68e38c8bc3cd3c1972682c91b798b6262584d4
github.com/nats-io/nats aea64801fab70c44603b524e0a0210c06727c972
github.com/nats-io/nuid 4f84f5f3b2786224e336af2e13dba0a0a80b76fa
github.com/nats-io/nuid a5152d67cf63cbfb5d992a395458722a45194715
github.com/pborman/uuid c55201b036063326c5b1b89ccfe45a184973d073
github.com/sony/sonyflake fa881fb1052b152e977c41023052c2f2a1c475e9
github.com/ugorji/go 45ce7596ace4534e47b69051a92aef7b64ec7b3f
Expand All @@ -38,4 +41,5 @@ golang.org/x/oauth2 04e1573abc896e70388bd387a69753c378d46466
google.golang.org/api 3f131f305a2ae45080e71fdb780128cc92e8745e
google.golang.org/genproto 9f48fed629f137e474fb7422a911dfad49e2eaae
google.golang.org/grpc 35896af9ad39c1fb1b1cd925fe3621be361e3d81
gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
gopkg.in/mgo.v2 22287bab4379e1fbf6002fb4eb769888f3fb224c
156 changes: 156 additions & 0 deletions backends/cassandra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@




```
# log onto container to get a cqlsh
docker run -it --rm --net container:lioenv_cass_1 cassandra:2 cqlsh
INSERT INTO user (id, name, deleted, created, updated) VALUES ('user814', 'test_name', false, '2016-07-24','2016-07-24 23:46:01')
cqlsh:datauxtest> select * from system.schema_columnfamilies WHERE keyspace_name = "datauxtest";
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:65 no viable alternative at input 'datauxtest' (...system.schema_columnfamilies WHERE keyspace_name = ["datauxtes]...)">
cqlsh:datauxtest> select * from system.schema_columnfamilies WHERE keyspace_name = 'datauxtest';
keyspace_name | columnfamily_name | bloom_filter_fp_chance | caching | cf_id | column_aliases | comment | compaction_strategy_class | compaction_strategy_options | comparator | compression_parameters | default_time_to_live | default_validator | dropped_columns | gc_grace_seconds | index_interval | is_dense | key_aliases | key_validator | local_read_repair_chance | max_compaction_threshold | max_index_interval | memtable_flush_period_in_ms | min_compaction_threshold | min_index_interval | read_repair_chance | speculative_retry | subcomparator | type | value_alias
---------------+-------------------+------------------------+---------------------------------------------+--------------------------------------+----------------+---------+-----------------------------------------------------------------+-----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------+----------------------+-------------------------------------------+-----------------+------------------+----------------+----------+----------------+----------------------------------------------------------------------------------------------------------------------------------+--------------------------+--------------------------+--------------------+-----------------------------+--------------------------+--------------------+--------------------+-------------------+---------------+----------+-------------
datauxtest | article | 0.01 | {"keys":"ALL", "rows_per_partition":"NONE"} | bfd51db0-4628-11e6-a329-4f04994f1f6a | [] | | org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy | {} | org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.ColumnToCollectionType(63617465676f7279:org.apache.cassandra.db.marshal.SetType(org.apache.cassandra.db.marshal.UTF8Type))) | {"sstable_compression":"org.apache.cassandra.io.compress.LZ4Compressor"} | 0 | org.apache.cassandra.db.marshal.BytesType | null | 864000 | null | False | ["author"] | org.apache.cassandra.db.marshal.UTF8Type | 0.1 | 32 | 2048 | 0 | 4 | 128 | 0 | 99.0PERCENTILE | null | Standard | null
datauxtest | event | 0.01 | {"keys":"ALL", "rows_per_partition":"NONE"} | 5d461c00-46cb-11e6-a329-4f04994f1f6a | ["ts"] | | org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy | {} | org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.TimestampType,org.apache.cassandra.db.marshal.UTF8Type) | {"sstable_compression":"org.apache.cassandra.io.compress.LZ4Compressor"} | 0 | org.apache.cassandra.db.marshal.BytesType | null | 864000 | null | False | ["date","url"] | org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type) | 0.1 | 32 | 2048 | 0 | 4 | 128 | 0 | 99.0PERCENTILE | null | Standard | null
datauxtest | user | 0.01 | {"keys":"ALL", "rows_per_partition":"NONE"} | bfe91ae0-4628-11e6-a329-4f04994f1f6a | [] | | org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy | {} | org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.ColumnToCollectionType(726f6c6573:org.apache.cassandra.db.marshal.SetType(org.apache.cassandra.db.marshal.UTF8Type))) | {"sstable_compression":"org.apache.cassandra.io.compress.LZ4Compressor"} | 0 | org.apache.cassandra.db.marshal.BytesType | null | 864000 | null | False | ["id"] | org.apache.cassandra.db.marshal.UTF8Type | 0.1 | 32 | 2048 | 0 | 4 | 128 | 0 | 99.0PERCENTILE | null | Standard | null
select columnfamily_name AS cf, key_aliases from system.schema_columnfamilies WHERE keyspace_name = 'datauxtest';
-- Events Table
CREATE TABLE event (
url varchar,
ts timestamp,
date text,
jsondata text,
PRIMARY KEY ((date, url), ts)
);
cqlsh:datauxtest> describe table datauxtest.event;
CREATE TABLE datauxtest.event (
date text,
url text,
ts timestamp,
jsondata text,
PRIMARY KEY ((date, url), ts)
) WITH CLUSTERING ORDER BY (ts ASC)
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 dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
# this is from a cassandra 2.2.6
cqlsh:system> describe table system.schema_columnfamilies;
CREATE TABLE system.schema_columnfamilies (
keyspace_name text,
columnfamily_name text,
bloom_filter_fp_chance double,
caching text,
cf_id uuid,
comment text,
compaction_strategy_class text,
compaction_strategy_options text,
comparator text,
compression_parameters text,
default_time_to_live int,
default_validator text,
dropped_columns map<text, bigint>,
gc_grace_seconds int,
is_dense boolean,
key_validator text,
local_read_repair_chance double,
max_compaction_threshold int,
max_index_interval int,
memtable_flush_period_in_ms int,
min_compaction_threshold int,
min_index_interval int,
read_repair_chance double,
speculative_retry text,
subcomparator text,
type text,
PRIMARY KEY (keyspace_name, columnfamily_name)
) WITH CLUSTERING ORDER BY (columnfamily_name ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = 'table definitions'
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.0
AND default_time_to_live = 0
AND gc_grace_seconds = 604800
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 3600000
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
# this is from cassandra 2.1.8
cqlsh:datauxtest> describe table system.schema_columnfamilies;
CREATE TABLE system.schema_columnfamilies (
keyspace_name text,
columnfamily_name text,
bloom_filter_fp_chance double,
caching text,
cf_id uuid,
column_aliases text,
comment text,
compaction_strategy_class text,
compaction_strategy_options text,
comparator text,
compression_parameters text,
default_time_to_live int,
default_validator text,
dropped_columns map<text, bigint>,
gc_grace_seconds int,
index_interval int,
is_dense boolean,
key_aliases text,
key_validator text,
local_read_repair_chance double,
max_compaction_threshold int,
max_index_interval int,
memtable_flush_period_in_ms int,
min_compaction_threshold int,
min_index_interval int,
read_repair_chance double,
speculative_retry text,
subcomparator text,
type text,
value_alias text,
PRIMARY KEY (keyspace_name, columnfamily_name)
) WITH CLUSTERING ORDER BY (columnfamily_name ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = 'ColumnFamily definitions'
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.0
AND default_time_to_live = 0
AND gc_grace_seconds = 604800
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 3600000
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
```
Loading

0 comments on commit 2fae98a

Please sign in to comment.