cqlsh

Cassandra cqlsh not working with where clause on non-partition key

扶醉桌前 提交于 2019-12-12 14:09:10
问题 My table describe is : CREATE TABLE user ( id text, CustID int static, UpdateDate date, DateOfBirth date static, Gender text static, Address text static, City text static, State text static, Zip text static, Email text static, Phone text static, OverallAssets double, PRIMARY KEY (id,UpdateDate) ); select * from user is working fine. select * from user where partition key is also working fine. But if I am putting non partition key in where clause getting below error.What can be the reason ?

Astyanax Cassandra Double type precision

自作多情 提交于 2019-12-12 10:47:43
问题 I'm trying to get a Double value from a Cassandra table with a double type column. I've created the table in CQL3 syntax: CREATE TABLE data_double ( datetime timestamp, value double, primary key (datetime) ); I've inserted a row: INSERT INTO data_double (datetime, value) VALUES ('111111111', 123.456); When I do: SELECT * from data_double; I get that the value is 123.46 Why is the value rounded? Thanks 回答1: The cqlsh utility by default will only display 5 digits of precision for floating point

How do you insert a string or text as a blob in Cassandra (specifically CQLSH)?

旧街凉风 提交于 2019-12-12 08:23:51
问题 I was trying to insert text or some string as a blob for testing purposes in CQLSH insert into test_by_score (commit, delta, test, score) values (textAsBlob('bdb14fbe076f6b94444c660e36a400151f26fc6f'), 0, textAsBlob('{"prefix": "enwiki", "title": "\"Aghnadarragh\""}'), 100); It didn't really work, because after I did: select * from test_by_score where commit = 0x0b5db8b91bfdeb0a304b372dd8dda123b3fd1ab6; its said there were 0 columns...which was a little unexpected (because it didn't throw an

Most efficient way to query cassandra in small time-based chunks

大城市里の小女人 提交于 2019-12-12 04:25:25
问题 My Cassandra-based application needs to read the rows changed since last read. For this purpose, we are planning to have a table changed_rows that will contain two columns - ID - The ID of the changed row and Updated_Time - The timestamp when it was changed. What is the best way to read such a table such that it reads small group of rows ordered by time. Example: if the table is: ID Updated_Time foo 1000 bar 1200 abc 2000 pqr 2500 zyx 2900 ... xyz 901000 ... I have shown IDs to be simple 3

cassandra - how to update decimal column by adding to existing value

大憨熊 提交于 2019-12-12 01:36:42
问题 I have a cassandra table that looks like the following: create table position_snapshots_by_security( securityCode text, portfolioId int, lastUpdated date, units decimal, primary key((securityCode), portfolioId) ) And I would like to something like this: update position_snapshots_by_security set units = units + 12.3, lastUpdated = '2017-03-02' where securityCode = 'SPY' and portfolioId = '5dfxa2561db9' But it doesn't work. Is it possible to do this kind of operation in Cassandra? I am using

Unable to create a table with comment

半世苍凉 提交于 2019-12-11 23:19:42
问题 I am trying to create a table and want to add a comment in the schema but I am not able to get the syntax correct. CREATE TABLE codingjedi.practice_questions_javascript_tag( year bigint, month bigint, creation_time_hour bigInt, creation_time_minute bigInt, id uuid, PRIMARY KEY ((year, month), creation_time_hour, creation_time_minute) ) WITH comment = 'some comment' CLUSTERING ORDER BY (creation_time_hour DESC, creation_time_minute ASC) 回答1: I had to use AND to combine the two instruction

Strange behavior of timeuuid comparison

☆樱花仙子☆ 提交于 2019-12-11 21:28:29
问题 I have Cassandra 2.x cluster with 3 nodes and the db scheme like this: cqlsh> CREATE KEYSPACE test_ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 3} AND durable_writes = true; cqlsh> CREATE TABLE IF NOT EXISTS test_ks.test_cf ( ... time timeuuid, ... user_id varchar, ... info varchar, ... PRIMARY KEY (time, user_id) ... ) WITH compression = {'sstable_compression': 'LZ4Compressor'} AND compaction = {'class': 'LeveledCompactionStrategy'}; Lets add some data (wait some

No rows inserted in table when import from CSV in Cassandra

老子叫甜甜 提交于 2019-12-11 13:47:41
问题 I am trying to import a CSV file to a Cassandra table however I am facing a problem. When inserted successfully, at least this is what Cassandra tells, I still can't see any record. Here is a little more details : qlsh:recommendation_engine> COPY row_historical_game_outcome_data FROM '/home/adelin/workspace/docs/re_raw_data2.csv' WITH DELIMITER='|'; 2 rows imported in 0.216 seconds. cqlsh:recommendation_engine> select * from row_historical_game_outcome_data; customer_id | game_id | time |

Cassandra: Unable to import null value from csv

主宰稳场 提交于 2019-12-11 13:38:25
问题 I am trying to import a csv file to Cassandra. The csv file has been generated from Postgres and it contains some null values. Cassandra version: [cqlsh 5.0.1 | Cassandra 3.5 | CQL spec 3.4.0 | Native protocol v4] I am using this query to import: copy reports (id,name,user_id,user_name,template_id,gen_epoch,exp_epoch,file_name,format,refile_size,is_sch,job_id,status,status_msg) from '/home/reports.csv' with NULL='' and header=true and DELIMITER = ','; I keep on receiving this error: Failed to

Cassandra 3.11.4 CQL GROUP BY Not working

喜夏-厌秋 提交于 2019-12-11 12:44:41
问题 I might be missing something very basic, or there is something very wrong; I am using Apache Cassandra 3.11.4 . Version details are as follows: Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.7.0 | CQL spec 3.4.2 | Native protocol v4] I have the following table and I want to get the count of individual citizen-ship status. CREATE TABLE population.residents ( residentId bigint, name varchar, office varchar, dob date, citizen text, PRIMARY KEY((residentId), dob) );