cql3

Materialised view error in Cassandra

徘徊边缘 提交于 2019-12-11 14:52:31
问题 I am new to Cassandra, I am trying to create a table and materialized view. but it not working. My queries are: -- all_orders create table all_orders ( id uuid, order_number bigint, country text, store_number bigint, supplier_number bigint, flow_type int, planned_delivery_date timestamp, locked boolean, primary key ( order_number,store_number,supplier_number,planned_delivery_date )); -- orders_by_date CREATE MATERIALIZED VIEW orders_by_date AS SELECT id, order_number, country, store_number,

Understanding the philosophy behind Cassandra

安稳与你 提交于 2019-12-11 11:54:15
问题 I am trying to get familiar with Apache Cassandra, for a particular PoC work. After going through various articles on the net, trying out various libraries/clients available, a particular question pops up in my mind. The initial reason why we thought of Cassandra, is because we wanted a 'truly' distributed datastore. From my understanding of 'distribution', it ultimately boils down to some sort of 'key-value' and some sort of 'consistent hashing', if I am able to express myself in a super

What is the best way to perform a subtraction on Cassandra by cqlsh request?

佐手、 提交于 2019-12-11 10:29:22
问题 I am trying to make a cqlsh request on Cassandra. The idea is analyse the average length from different 'gene' registers that had been annotated in a genome. After enter the data, I have this athaliana.tab table: id | chr | comments | end | orf | sense | start | type --------------------------------------+-----+-------------------+----------+-----+-------+----------+------ d2ab2520-6734-11e5-955c-234085c1edec | 1 | gene_id AT1G16340 | 5590338 | 0 | - | 5590241 | CDS d4169c00-6734-11e5-955c

Datastax: Re-preparing already prepared query warning

a 夏天 提交于 2019-12-11 09:37:11
问题 I have this code UUID notUuid = UUIDs.timeBased(); PreparedStatement pstmt = cqlSession.prepare("INSERT INTO mytable(userId, notifId, notification, time, read, deleted) VALUES(?, ?, ?, ?, ?, ?)"); BoundStatement boundStatement = new BoundStatement(pstmt); cqlSession.execute(boundStatement.bind(userId, notUuid, notfMsg, System.currentTimeMillis(), MigificConstants.UNREAD, "false")); when i run this code, in the log it shows Re-preparing already prepared query INSERT INTO mytable(userId,

How can a CSV file with counter columns be loaded to a Cassandra CQL3 table

ⅰ亾dé卋堺 提交于 2019-12-11 04:27:41
问题 I have a CSV file in the following format key1,key2,key3,counter1,counter2,counter3,counter4 1,2,1,0,0,0,1 1,2,2,0,1,0,4 The CQL3 table has all value columns of type 'counter'. When I try to use the COPY command to load the CSV I get the usual error which asks for an UPDATE instead of an INSERT. The question is : how can I tell CQL to use an UPDATE ? Is there any other way to do this ? 回答1: using sstables solved this issue. Although a little slower than what i expected , it does the job 回答2:

cassandra - The same query work with cql but not with python driver

五迷三道 提交于 2019-12-11 02:36:25
问题 I have a strange problem here. I have a cassandra table called events_prime and I want to request the DB to get elements from this table with a WHERE clause. I am using the python cassandra-driver and this is my request: prep_stment = session.prepare(""" SELECT * FROM events_prime WHERE "websiteId" = '%s-%s' AND churner=True AND "currentTime" > '%s' AND "currentTime" < '%s' LIMIT 20000; """%(platform,client,time_2,time_1)) print prep_stment print "Request DB..." frames = [] for res in session

default sorting order of columns in cassandra?

痞子三分冷 提交于 2019-12-10 20:24:59
问题 I was going through the tutorial where the instructor says that the default ordering of columns with in a row is UTF8-tye . But he does not touch upon it further. I don't understand what it means. especially what if my columns are different types such as int , timestamp etc. Also how would I specify the sort order on the columns to be something other than "UTF8-type". 回答1: He is talking about the columns names, not the columns values. In old cassandra versions you could use SuperColumns,

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

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 timing out when queried for key that have over 10,000 rows even after giving timeout of 10sec

和自甴很熟 提交于 2019-12-08 09:28:50
问题 Im using a DataStax Community v 2.1.2-1 (AMI v 2.5) with preinstalled default settings. And i have a table : CREATE TABLE notificationstore.note ( user_id text, real_time timestamp, insert_time timeuuid, read boolean, PRIMARY KEY (user_id, real_time, insert_time)) WITH CLUSTERING ORDER BY (real_time DESC, insert_time ASC) AND bloom_filter_fp_chance = 0.01 AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"} AND **default_time_to_live** = 20160 The other configurations are: I have 2