cassandra-2.0

Efficient way to store a JSON string in a Cassandra column?

匆匆过客 提交于 2019-12-04 10:06:45
问题 Cassandra newbie question. I'm collecting some data from a social networking site using REST calls. So I end up with the data coming back in JSON format. The JSON is only one of the columns in my table. I'm trying to figure out what the "best practice" is for storing the JSON string. First I thought of using the map type, but the JSON contains a mix of strings, numerical types, etc. It doesn't seem like I can declare wildcard types for the map key/value. The JSON string can be quite large,

JavaSparkContext not serializable

柔情痞子 提交于 2019-12-04 04:58:02
I'm using spark with cassandra, and i hava a JavaRDD<String> of clients. And for each client, i want to select from cassandra his Interactions like this : avaPairRDD<String, List<InteractionByMonthAndCustomer>> a = client.mapToPair(new PairFunction<String, String, List<InteractionByMonthAndCustomer>>() { @Override public Tuple2<String, List<InteractionByMonthAndCustomer>> call(String s) throws Exception { List<InteractionByMonthAndCustomer> b = javaFunctions(sc) .cassandraTable(CASSANDRA_SCHEMA, "interaction_by_month_customer") .where("ctid =?", s) .map(new Function<CassandraRow,

Cassandra Static Column design [closed]

蓝咒 提交于 2019-12-04 03:44:33
How are static columns stored internally in cassandra? Can someone please post an example discussing the design implementation of static column in cassandra? Why don't we take a look at the structure of a table with static columns on disk and find out? cqlsh:test> CREATE TABLE test (k int, v int, s int static, d int, PRIMARY KEY(k,v)) cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 1 ,20, 1 ); cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 3 ,21, 2 ); cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 2 ,21, 2 ); Exit out of C* and run nodetool flush to make our sstables. Run

Atomic Batches in Cassandra

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:46:30
What do you mean by Batch Statements are atomic in cassandra? Docs are a bit confusing in nature to be precise. Does it mean that queries are atomic across nodes in cluster? Say,for example, i have a batch with 100 queries. If the 40th query in batch fails, what happens to the 39 queries executed in the batch? I understand that there is a batchlog created under the hood and it will take care of the consistency for partial batches. Does it remove the rest of the 39 entries and provide the required atomic nature of batch queries. In MYSQL, we set autocommit to false and hence we can rollback.

Overwrite row in cassandra with INSERT, will it cause tombstone?

心不动则不痛 提交于 2019-12-03 12:22:22
Writing data to Cassandra without causing it to create tombstones are vital in our case, due to the amount of data and speed. Currently we have only written a row once, and then never had the need to update the row again, only fetch the data again. Now there has been a case, where we actually need to write data, and then complete it with more data, that is finished after awhile. It can be made by either; overwrite all of the data in a row again using INSERT (all data is available), or performing an Update only on the new data. What is the best way to do it, bear in mind of the speed and not

Modeling many-to-many relations in Cassandra 2 with CQL3

你说的曾经没有我的故事 提交于 2019-12-03 07:37:23
What is the canonical way to model many-to-many relations with CQL3 ? Let's say I have to tables CREATE TABLE actor ( id text PRIMARY KEY, given text, surname text, ) CREATE TABLE fan ( id text PRIMARY KEY, given text, surname text, ) and I'd like to model the fact that an actor can have many fan and each fan can like many actors. The first idea that came to my my was to use sets , like in the following (and the other way around for fans): CREATE TABLE actor ( id text PRIMARY KEY, given text, surname text, fans set<text> ) <similarly for fan> but it seems they are meant for small sets, and I

Efficient way to store a JSON string in a Cassandra column?

♀尐吖头ヾ 提交于 2019-12-03 05:00:40
Cassandra newbie question. I'm collecting some data from a social networking site using REST calls. So I end up with the data coming back in JSON format. The JSON is only one of the columns in my table. I'm trying to figure out what the "best practice" is for storing the JSON string. First I thought of using the map type, but the JSON contains a mix of strings, numerical types, etc. It doesn't seem like I can declare wildcard types for the map key/value. The JSON string can be quite large, probably over 10KB in size. I could potentially store it as a string, but it seems like that would be

Cassandra “no viable alternative at input”

☆樱花仙子☆ 提交于 2019-12-02 20:20:19
I am trying to insert a simple row into the table. Can someone point out what is happening here ? CREATE TABLE recommendation_engine_poc.user_by_category ( game_category text, customer_id text, amount double, game_date timestamp, PRIMARY KEY (game_category, customer_id) ) WITH CLUSTERING ORDER BY (customer_id 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

Best practices on upgrading cassandra

折月煮酒 提交于 2019-12-02 16:33:15
问题 I am getting errors from pyspark connecting to cassandra because it appears I am using a too old a cassandra: [idf@node1 python]$ nodetool -h localhost version ReleaseVersion: 2.0.17 [idf@node1 python]$ [idf@node1 cassandra]$ java --version Unrecognized option: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. [idf@node1 cassandra]$ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

com.impetus.kundera.query.QueryHandlerException: No entity found by the name: <EntityName>

萝らか妹 提交于 2019-12-02 16:19:07
问题 I am getting the following error when I run my application through SBT Console in Intellij IDEA 15, when the list page is opened which shows records from database: com.impetus.kundera.query.QueryHandlerException: No entity found by the name: Employee at com.impetus.kundera.query.KunderaQuery.initEntityClass(KunderaQuery.java:608) ~[kundera-core-3.2.jar:na] at com.impetus.kundera.query.KunderaQuery.postParsingInit(KunderaQuery.java:540) ~[kundera-core-3.2.jar:na] at com.impetus.kundera.query