cql3

Exception when connecting to Cassandra with CQL using DataStax Java driver 1.0.4

守給你的承諾、 提交于 2019-12-06 05:35:19
问题 I have Cassandra 1.2.11 running on my laptop. I can connect to it using nodetool and cqlsh but when I try and use the DataStax 1.0.4 Java API to connect using CQL 3.0 I get the following error: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1 ([localhost/127.0.0.1] Unexpected error during transport initialization (com.datastax.driver.core.TransportException: [localhost/127.0.0.1] Channel has been closed))) at com

Finding distinct values of non Primary Key column in CQL Cassandra

寵の児 提交于 2019-12-05 05:39:04
I use the following code for creating table: CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; USE mykeyspace; CREATE TABLE users ( user_id int PRIMARY KEY, fname text, lname text ); INSERT INTO users (user_id, fname, lname) VALUES (1745, 'john', 'smith'); INSERT INTO users (user_id, fname, lname) VALUES (1744, 'john', 'doe'); INSERT INTO users (user_id, fname, lname) VALUES (1746, 'john', 'smith'); I would like to find the distinct value of lname column (that is not a PRIMARY KEY). I would like to get the following result: lname -------

how to construct range query in cassandra?

不打扰是莪最后的温柔 提交于 2019-12-05 05:34:09
CREATE TABLE users ( userID uuid, firstname text, lastname text, state text, zip int, age int, PRIMARY KEY (userID) ); I want to construct the following queries: select * from users where age between 30 and 40 select * from users where state in "AZ" AND "WA" I know I need two more tables to do this query but I dont know how the should be? EDIT From Carlo's comments, I see this is the only possibility CREATE TABLE users ( userID uuid, firstname text, lastname text, state text, zip int, age int, PRIMARY KEY (age,zip,userID) ); Now to select Users with age between 15 and 30. this is the only

Cassandra Non-Counter Family

馋奶兔 提交于 2019-12-05 01:21:58
I'm attempted to execute the following CQL 3 statement CREATE TABLE summary ( id uuid, "client" bigint, "campaign" text, "unit" bigint, "view" counter, PRIMARY KEY ("client", "campaign", "unit")); The error I'm getting is that I cannot create a counter column on a non-counter column family. Any ideas? The solution to this issue is that any non-counter column must be part of the primary key. The column id uuid was the one causing the issue, removing it allowed the table to be created. Tables that contain counters can only contain counters. Andremoniy That's a limitation of the current counter

Non frozen collections and user defined types on Cassandra 2.1.8

℡╲_俬逩灬. 提交于 2019-12-04 23:19:31
I'm trying to run the following example from here CREATE TYPE address ( street text, city text, zip int ); CREATE TABLE user_profiles ( login text PRIMARY KEY, first_name text, last_name text, email text, addresses map<text, address> ); However, when I try to create the user_profiles table, I get the following error: InvalidRequest: code=2200 [Invalid query] message="Non-frozen collections are not allowed inside collections: map<text, address> Any thoughts on why this could be happening? I am running 2.1.8 and I get the same error message. To fix this, you need the frozen keyword: CREATE TABLE

How to list column families in keyspace?

女生的网名这么多〃 提交于 2019-12-04 22:27:09
How can I get list of all column families in keyspace in Cassandra using CQL 3? cqlsh> select columnfamily_name from system.schema_columnfamilies where keyspace_name = 'test'; columnfamily_name ------------------- commits foo has_all_types item_by_user test test2 user_by_item (7 rows) Or even more simply (if you are using cqlsh), switch over to your keyspace with use and then execute describe tables : cqlsh> use products; cqlsh:products> describe tables; itemmaster itemhierarchy companyitemfavorites testtable Note: The describe command is specific to cqlsh only. prayagupd CQL API supports both

High number of tombstones with TTL columns in Cassandra

一曲冷凌霜 提交于 2019-12-04 20:15:23
I have a cassandra Column Family, or CQL table with the following schema: CREATE TABLE user_actions ( company_id varchar, employee_id varchar, inserted_at timeuuid, action_type varchar, PRIMARY KEY ((company_id, employee_id), inserted_at) ) WITH CLUSTERING ORDER BY (inserted_at DESC); Basically a composite partition key that is made up of a company ID and an employee ID, and a clustering column, representing the insertion time, that is used to order the columns in reverse chronological order (newest actions are at the beginning of the row). Here's what an insert looks like: INSERT INTO user

User Defined Type (UDT) behavior in Cassandra

一世执手 提交于 2019-12-04 20:13:56
if someone has some experience in using UDT (User Defined Types), I would like to understand how the backward compatibility would work. Say I have the following UDT CREATE TYPE addr ( street1 text, zip text, state text ); If I modify "addr" UDT to have a couple of more attributes (say for example zip_code2 int, and name text): CREATE TYPE addr ( street1 text, zip text, state text, zip_code2 int, name text ); how does the older rows that does have these attributes work? Is it even compatible? Thanks The new UDT definition would be compatible with the old definition. User-defined types can have

Cassandra CQL3 composite key not written by Hadoop reducer

杀马特。学长 韩版系。学妹 提交于 2019-12-04 19:22:21
I'm using Cassandra 1.2.8, and have several Hadoop MapReduce jobs, that read rows from some CQL3 tables and write result back to another CQL3 tables. If output CQL3 tables contain composite key, values of the composite key fields are not written by reducer - instead I see empty values for those fields, while performing select query in cqlsh. If the primary key is not composite, everything works correctly. Example of the output CQL3 table with composite key: CREATE TABLE events_by_type_with_source ( event_type_id ASCII, period ASCII, date TIMESTAMP, source_name ASCII, events_number COUNTER,

Exception when connecting to Cassandra with CQL using DataStax Java driver 1.0.4

牧云@^-^@ 提交于 2019-12-04 12:47:53
I have Cassandra 1.2.11 running on my laptop. I can connect to it using nodetool and cqlsh but when I try and use the DataStax 1.0.4 Java API to connect using CQL 3.0 I get the following error: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1 ([localhost/127.0.0.1] Unexpected error during transport initialization (com.datastax.driver.core.TransportException: [localhost/127.0.0.1] Channel has been closed))) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:186) I am using the