cql

Why does this CQL return empty results with beginning and ending date range are the same value

有些话、适合烂在心里 提交于 2019-12-11 11:14:46
问题 I am writing a parameterized CQL statement that is not behaving as I would expect. I am trying to return a list of records for a range of dates that in this instance are using the same date for the beginning and end points. The table is defined as follows: CREATE TABLE sometable ( partition_key varchar, cluster_start_date timestamp, other_cluster_key varchar, data varchar, PRIMARY KEY((partition_key), cluster_start_date, other_cluster_key) ) WITH CLUSTERING ORDER BY(cluster_start_date ASC,

Querying Large Datasets in Cassandra

旧时模样 提交于 2019-12-11 11:03:39
问题 I am by experience a RDBMS programmer. I am working on a scientific research problem involving genomic data. I was assigned to explore Cassandra since we needed a Big Data, scalable and cheap (free) solution. Setting Cassandra up and loading it with data was seductively trivial and similar to my experience with traditional DBs like Oracle and MySQL. My problem is finding a simple strategy to query data since this is a fundamental requirement for all data repositories. The data I am working

cassandra - how to perform table query?

ぐ巨炮叔叔 提交于 2019-12-11 10:19:02
问题 I am trying to perform a query using 2 tables: CREATE TABLE users( id_ UUID PRIMARY KEY, username text, email text, ); CREATE TABLE users_by_email( id UUID, email text PRIMARY KEY ) In this cas, how to perform a query by email? 回答1: I am assuming that you also want username returned in the query. You cannot JOIN tables in Cassandra. So to do that, you will have to add that column to your users_by_email table: CREATE TABLE users_by_email( id UUID, email text PRIMARY KEY, username text, ); Then

how to use in and order by at the same time in cassandra

╄→гoц情女王★ 提交于 2019-12-11 10:06:50
问题 I see the official document: https://docs.datastax.com/en/cql/3.1/cql/cql_using/useColumnsSort.html can use "SELECT * FROM users WHERE userID IN (102,104) ORDER BY age ASC;" how to define the users table or materialized view? PAGING OFF is a must? Here is my current view: CREATE MATERIALIZED VIEW navigation_by_id_time AS SELECT * FROM navigation WHERE competition_id IS NOT NULL AND event_type_id IS NOT NULL AND event_id IS NOT NULL AND market_id IS NOT NULL AND market_start_time IS NOT NULL

read data from cassandra using java

≡放荡痞女 提交于 2019-12-11 07:28:28
问题 My sample cassandra table looks like id | article_read | last_hours | name ----+----------------------------------- 5 | [4, 5, 6] | 5 | shashank 10 | [12, 88, 32] | 1 | sam 8 | [4, 5, 6] | 8 | aman 7 | [5, 6] | 7 | ashif 6 | [4, 5, 6] | 6 | amit 9 | [4, 5, 6] | 9 | shekhar My java code to read data from Cassandra table using cql queries, Scanner sc = new Scanner(System.in); System.out.println("enter name1 "); String name1 = sc.nextLine(); System.out.println("enter name2"); String name2 = sc

Datastax Cassandra PIG Running only one MAP

我只是一个虾纸丫 提交于 2019-12-11 07:25:17
问题 I am using Datastax Cassandra 3.1.4 with two nodes. I am running pig with CqlStorage() with 12million rows in the table, but I find there is only one map running for a simple pig command. I tried changing split_size in my pig relation but it didn't worked. Here is my sample query. x = load'cql://Mykeyspace/MyCF?split_size=1000' using CqlStorage(); y = limit x 500; dump y I didn't find input.split.size property in my mapred-site.xml I am assuming default split size is 64*1024 I tried set pig

Cassandra :[Invalid query] message=“PRIMARY KEY column ”lng" cannot be restricted

白昼怎懂夜的黑 提交于 2019-12-11 07:17:47
问题 I am getting an error while executing following query in cqlsh Query SELECT * FROM ragchews.disc_location WHERE country_code = 12 AND lat > 100.00 and lat < 120.00 and lng > 50 and lng < 100 allow filtering; Table CREATE TABLE ragchews.disc_location ( country_code int, lat float, lng float, uid text, PRIMARY KEY (country_code, lat, lng, uid) ); Error: code=2200 [Invalid query] message="PRIMARY KEY column "lng" cannot be restricted (preceding column "ColumnDefinition{name=lat, type=org.apache

How to get current year on cassandra

老子叫甜甜 提交于 2019-12-11 06:26:40
问题 How can I get just a part of the current date in Cassandra? In my particular case I need to get just the year. I got to this for the moment select dateof(now()) from system.local; But I could not find any function to get just the year in the documentation https://docs.datastax.com/en/dse/5.1/cql/cql/cql_reference/refCqlFunction.html#refCqlFunction__toTimestamp I'm new with Cassandra so this maybe a silly question. 回答1: The safe way, would be to return a timestamp and parse-out the year client

Why Cassandra COUNT(*) on a specific partition takes really long on relatively small datasets

无人久伴 提交于 2019-12-11 06:17:54
问题 I have a table defined like: Keyspace : CREATE KEYSPACE messages WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; Table : CREATE TABLE messages.textmessages ( categoryid int, date timestamp, messageid timeuuid, message text, userid int, PRIMARY KEY ((categoryid, date), messageid) ) WITH CLUSTERING ORDER BY (messageid ASC); The goal is to have a wide row time-series storage such that categoryid and date (beginning of day) constitutes my

gocql SELECT * doesn't return all columns

╄→гoц情女王★ 提交于 2019-12-11 03:57:53
问题 I came across this weird behaviour while trying to implement some counters for my application. Basically, I did a counter table like so : CREATE TABLE stats_dev.log_counters ( date text PRIMARY KEY, all counter ); Then I have some specific types of message I want to count as well, so in my Go app, I ALTER the table to add the column I didn't have before. My app is growing, and I start to have more than 30 columns (shouldn't be more than 50) and when I want to retrieve all those counters, some