cql

Sorting order in cassandra result

那年仲夏 提交于 2019-12-10 21:04:10
问题 I created table CREATE TABLE testtab ( testtabmainid bigint, testtabid timeuuid, posteddate timestamp, description text, year bigint, month bigint, day bigint, PRIMARY KEY ((year,month,day),posteddate,testtabmainid) ) WITH CLUSTERING ORDER BY (posteddate DESC,testtabmainid desc); then on SELECT testtabmainid,posteddate,year,month, day FROM testtab; i got result like this testtabmainid / posteddate / year / month / day 90 / 2016-12-01 11:19:11+0530 / 2016 / 11 / 30 89 / 2016-11-30 16:21:58

Cassandra bulk insert operation, internally

﹥>﹥吖頭↗ 提交于 2019-12-10 18:53:56
问题 I am looking for Cassandra/CQL's cousin of the common SQL idiom of INSERT INTO ... SELECT ... FROM ... and have been unable to find anything to do such an operation programmatically or in CQL. Is it just not supported? My use case is to do a reasonably bulky copy from one table to another. I don't need any particular concurrent guarantees, but it's a lot of data so I'd like to avoid the additional network overhead of writing a client that retrieves data from one table, then issues batches of

Cassandra - Write doesn't fail, but values aren't inserted

本秂侑毒 提交于 2019-12-10 18:29:05
问题 I have a cluster of 3 Cassandra 2.0 nodes. My application I wrote a test which tries to write and read some data into/from Cassandra. In general this works fine. The curiosity is that after I restarted my computer, this test will fail, because after writting I read the same value I´ve write before and there I get null instead of the value, but the was no exception while writing. If I manually truncate the used column family, the test will pass. After that I can execute this test how often I

Creating composite COLUMNS (not keys) with CQL 3

耗尽温柔 提交于 2019-12-10 17:55:55
问题 This article discusses possible ways CQL 3 could be used for creating composite columns in Cassandra 1.1. They are just ideas. Nothing is official, and the Datastax documentation doesn't cover this (only composite keys). As I understand it, composite columns are a number of columns that together have only one value. How do you create them with CQL? EDIT I will be using C# to interface into Cassandra. CQL looks straightforward to use, which is why I want to use it. 回答1: You've got a couple

Columns ordering in Cassandra

大兔子大兔子 提交于 2019-12-10 17:22:42
问题 When I create a table in CQL, is it necessary to be exact for the order of column that are NOT in the primary_key and NOT clustering columns : CREATE TABLE user ( a ascii, b ascii, c ascii, PRIMARY KEY (a) ); Is it equivalent to ? CREATE TABLE user ( a ascii, c ascii, <-- switched b ascii, <-- switched PRIMARY KEY (a) ); Thank you for your help 回答1: Both of those statements will fail, because of: The extra comma. You have not provided a primary key definition. Assuming you had those fixed,

Cassandra 3.9 and CQL spec version

╄→гoц情女王★ 提交于 2019-12-10 15:48:19
问题 Just curious what versions of cql are supported in Cassandra 3.9. I know that cql 3.4.2 is supported in Cassandra 3.9, but whether 3.4.3 is supported too? and how to upgrade/config Cassandra 3.9 to use cql 3.4.3? I searched on Internet, I found some information such as Which CQL version corresponds to which Cassandra version?, https://docs.datastax.com/en/landing_page/doc/landing_page/compatibility.html, and so on, but these posts can not help me. Any comments welcomed. Thanks 回答1: Just

Understanding “Number of keys” in nodetool cfstats

早过忘川 提交于 2019-12-10 14:24:25
问题 I am new to Cassandra, in this example i am using a cluster with 1 DC and 5 nodes and a NetworkTopologyStrategy with replication factor as 3. Keyspace: activityfeed Read Count: 0 Read Latency: NaN ms. Write Count: 0 Write Latency: NaN ms. Pending Tasks: 0 Table: feed_shubham SSTable count: 1 Space used (live), bytes: 52620684 Space used (total), bytes: 52620684 SSTable Compression Ratio: 0.3727660543119897 Number of keys (estimate): 137984 Memtable cell count: 0 Memtable data size, bytes: 0

How do I retrieve table names in Cassandra using Java?

孤人 提交于 2019-12-10 13:22:19
问题 If is use this code in a CQL shell , I get all the names of table(s) in that keyspace. DESCRIBE TABLES; I want to retrieve the same data using ResulSet . Below is my code in Java. String query = "DESCRIBE TABLES;"; ResultSet rs = session.execute(query); for(Row row : rs) { System.out.println(row); } While session and cluster has been initialized earlier as: Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect("keyspace_name"); Or I like

Cassandra Full-Text Search

隐身守侯 提交于 2019-12-10 12:33:52
问题 Full-Text search in Cassandra; I am fairly new to Cassandra, and wish to understand it more properly. I am attempting to perform a Full-Text search in Cassandra, but after some research I have found that there may not be a "simple" approach for this.. and I say maybe because the first page of Google hasn't said much of anything. So I am trying to understand now instead, what is the best approach here.. This sort of lead me to take make up my own assumptions based on what I've learned so far

GoCQL : Marshal string into timestamp

青春壹個敷衍的年華 提交于 2019-12-10 11:22:49
问题 I am developing a time series data model with clustering column i.e. CREATE TABLE events ( id text, time timestamp, type text, val double, PRIMARY KEY (id, time) ) WITH CLUSTERING ORDER BY (time DESC) I wish to perform a select against the partition column 'id' and clustering column 'time'. For example, id:='1', timestamp:='2017-10-09' query := "SELECT id, time, type, val FROM events WHERE id=? AND time>=?" iterable := Cassandra.Session.Query(query, id, timestamp).Consistency(gocql.One).Iter(