cql3

Cassandra CQL wildcard search

◇◆丶佛笑我妖孽 提交于 2019-12-23 12:32:43
问题 I have a table structure like create table file(id text primary key, fname text, mimetype text, isdir boolean, location text); create index file_location on file (location); and following is the content in the table: insert into file (id, fname, mimetype, isdir, location) values('1', 'f1', 'pdf', False, 'c:/test/'); insert into file (id, fname, mimetype, isdir, location) values('2', 'f2', 'pdf', False, 'c:/test/'); insert into file (id, fname, mimetype, isdir, location) values('3', 'f3', 'pdf

Cassandra time based query

若如初见. 提交于 2019-12-23 11:56:25
问题 I have the following Cassandra table which records the user access to a web page. create table user_access ( id timeuuid primary key, user text, access_time timestamp ); and would like to do a query like this: get the list of users who access the page for more than 10 times in the last hour. Is it possible to do it in Cassandra? (I'm kind of stuck with the limited CQL query functionalities) If not, how do I remodel the table to do this? 回答1: Can you do it? yes. Can you do it efficiently? I'm

Cassandra time based query

廉价感情. 提交于 2019-12-23 11:56:11
问题 I have the following Cassandra table which records the user access to a web page. create table user_access ( id timeuuid primary key, user text, access_time timestamp ); and would like to do a query like this: get the list of users who access the page for more than 10 times in the last hour. Is it possible to do it in Cassandra? (I'm kind of stuck with the limited CQL query functionalities) If not, how do I remodel the table to do this? 回答1: Can you do it? yes. Can you do it efficiently? I'm

Unable to start cqlsh in Mac OS X?

情到浓时终转凉″ 提交于 2019-12-23 09:28:11
问题 I have installed cassandra 2.0 successfully. When I try to start cql 3 I get no such option: cassandra -v 2.0.9 ./cqlsh -3 Usage: cqlsh [options] [host [port]] cqlsh: error: no such option: -3 回答1: Once cassandra is starded (I guess in localhost with default settings) you can connect using ./cqlsh localhost if you want start it with a specific (older) version you can do ./cqlsh --cqlversion=X.Y.Z localhost; where X.Y.Z is the version (eg: 3.1.0) 来源: https://stackoverflow.com/questions

Paging Resultsets in Cassandra with compound primary keys - Missing out on rows

我的梦境 提交于 2019-12-23 08:47:38
问题 So, my original problem was using the token() function to page through a large data set in Cassandra 1.2.9, as explained and answered here: Paging large resultsets in Cassandra with CQL3 with varchar keys The accepted answer got the select working with tokens and chunk size, but another problem manifested itself. My table looks like this in cqlsh: key | column1 | value ---------------+-----------------------+------- 85.166.4.140 | county_finnmark | 4 85.166.4.140 | county_id_20020 | 4 85.166

Cassandra CQL query check multiple values

℡╲_俬逩灬. 提交于 2019-12-23 08:18:27
问题 How can I check if a non-primary key field's value is either 'A' or 'B' with a Cassandra CQL query? (I'm using Cassandra 2.0.1) Here's the table definition: CREATE TABLE my_table ( my_field text, my_field2 text, PRIMARY KEY (my_field) ); I tried: 1> SELECT * FROM my_table WHERE my_field2 IN ('A', 'B'); 2> SELECT * FROM my_table WHERE my_field2 = 'A' OR my_field = 'B' ; The first one failed with this messeage: Bad Request: IN predicates on non-primary-key columns (my_field2) is not yet

Cassandra CQL 3 - Prefix Select

青春壹個敷衍的年華 提交于 2019-12-23 02:59:08
问题 is there a way to perform a select based on a string prefix using CQL3? For example, consider the following table: Key | Value ------------ ABC | 0x01 ABD | 0x02 BBB | 0x03 I want to select all the keys with the prefix 'AB'. The database will be used to store spacial information, using a geohash approach. 回答1: That is not possible "out of the box"... However, there are some "tricks" people came up with, see these two posts: Cassandra (Pycassa/CQL) Return Partial Match Is there any query for

Cassandra non counter family

前提是你 提交于 2019-12-22 09:41:29
问题 I attempted to create a table with counter as one of the column type in cassandra but getting the following error: ConfigurationException: ErrorMessage code=2300 [Query invalid because of configuration issue] message="Cannot add a counter column (transaction_count) in a non counter column family" My table schema is as follows: CREATE TABLE MARKET_DATA_TRANSACTION_COUNT ( TRADE_DATE TIMESTAMP, SECURITY_EXCHANGE TEXT, PRODUCT_CODE TEXT, SYMBOL TEXT, SPREAD_TYPE TEXT, USER_DEFINED TEXT, PRODUCT

Fetching datapoint in cassandra based on statistics

喜夏-厌秋 提交于 2019-12-22 08:24:09
问题 I'm testing out Cassandra (2.0) as a possible replacement for storing our time-series data. I made a simple table and dumped some of our data into it: CREATE TABLE DataRaw( channelId int, sampleTime timestamp, value double, PRIMARY KEY (channelId, sampleTime) ) WITH CLUSTERING ORDER BY (sampleTime ASC); I can quite easily perform the most used queries like first value, last value (current) and get statistics via max, min, count, avg etc. But I also need to not only fetch the max value in a

how to construct range query in cassandra?

故事扮演 提交于 2019-12-22 04:58:28
问题 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