cql3

Cassandra alter column type: which types are compatible?

半腔热情 提交于 2019-11-30 15:58:15
There's some patchy information on the interwebs about some examples when column type can't be changed. For example, on the DataStax site there's a mention: Changing the type of a clustering column. Changing columns on which an index is defined. Or, for example, here is mentioned that you can't convert uuid to timeuuid . And from my personal experience, I can't change text to timestamp (we store dates in ISO8601 format as text, an unfortunate decision early in the project timeline). However, I can't find a full description of which types can be converted to which, or at least which types can't

Where and Order By Clauses in Cassandra CQL

╄→尐↘猪︶ㄣ 提交于 2019-11-30 13:14:44
I am new to NoSQL database and have just started using apache Cassandra. I created a simple table "emp" with primary key on "empno" column. This is a simple table as we always get in Oracle's default scott schema. Now I loaded data using the COPY command and issued query Select * from emp order by empno but I was surprised that CQL did not allow Order by on empno column (which is PK). Also when I used Where condition, it did not allow any inequality operations on empno column (it said only EQ or IN conditions are allowed). It also did not allowed Where and Order by on any other column, as they

Iterating through Cassandra wide row with CQL3

百般思念 提交于 2019-11-30 12:15:39
问题 How can I pull in a range of Composite columns with CQL3? Consider the following: CREATE TABLE Stuff ( a int, b text, c text, d text, PRIMARY KEY (a,b,c) ); In Cassandra what this effectively does is creates a ColumnFamily with integer rows (values of a) and with CompositeColumns composed of the values of b and c and the literal string 'd'. Of course this is all covered up by CQL3 so that we will think that we're inserting into individual database rows... but I digress. And consider the

Range query on secondary index in cassandra

北城余情 提交于 2019-11-30 09:55:34
I am using cassandra 2.1.10. So First I will clear that I know secondary index are anti-pattern in cassandra.But for testing purpose I was trying following: CREATE TABLE test_topology1.tt ( a text PRIMARY KEY, b timestamp ) WITH bloom_filter_fp_chance = 0.01 AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}' AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'} AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND gc_grace

How to rename table in Cassandra CQL3

余生长醉 提交于 2019-11-30 08:11:48
I'm trying to rename table created via CQLSH. E.g. rename table "AAA" to "BBB". Can't find any command to do so. Any ideas? Using [cqlsh 3.1.6 | Cassandra 1.2.8 | CQL spec 3.0.0 | Thrift protocol 19.36.0] I don't believe you can rename tables or keyspaces, there's no CQL3 operation to do it, and nothing in the old Thirft interfaces either, if I remember correctly. One reason why you can't is that it would be an extremely hard thing for Cassandra to do due to its distributed nature, the change can't be done atomically so the cluster would be in an inconsistent state, and most likely updates

Does collections in CQL3 have certain limits?

為{幸葍}努か 提交于 2019-11-30 08:08:52
问题 As there are two ways to support wide rows in CQL3..One is to use composite keys and another is to use collections like Map, List and Set. The composite keys method can have millions of columns (transposed to rows).. This is solving some of our use cases. However, if we use collections, I want to know if there is a limit that the collections can store a certain number/amount of data (Like earlier with Thrift C* supports up-to 2 billion columns in a row) 回答1: Apart from the performance issue,

How do I set the consistency level of an individual CQL query in CQL3?

懵懂的女人 提交于 2019-11-30 06:52:29
In the earlier beta releases of CQ L, there was a command I could use to set the read / write consistency of an individual CQL operation. It looked like this: SELECT * FROM users WHERE state='TX' USING CONSISTENCY QUORUM; I use CQL3 regularly and have a use-case where I need to be able to perform a read with a higher consistency level than the rest of our application. I looked through the CQL3 reference and didn't find any mention of any CQL syntax that allows me to change the consistency settings on a per-query basis, unless I'm using cqlsh (not useful for application development.) How am I

Counter Vs Int column in Cassandra?

不羁的心 提交于 2019-11-30 04:38:51
问题 I'm new in Cassandra. I can't understand what is the advantage of using counter in a table (or even in a different table if the non-counter columns are not part of the composite PRIMARY KEY)? Why we don't use a column with Int type, when I will have some statements like x=x++; what is the different between using int or counter? Is that possible to use increments or decrements for Int Type in Cassandra at all? 回答1: Why we don't use a column with Int type, when I will have some statements like

Difference between UPDATE and INSERT in Cassandra?

五迷三道 提交于 2019-11-30 04:12:24
What is the difference between UPDATE and INSERT when executing CQL against Cassandra? It looks like there used to be no difference, but now the documentation says that INSERT does not support counters while UPDATE does. Is there a "preferred" method to use? Or are there cases where one should be used over the other? Thanks so much! Counter Columns in Cassandra couldn't be set to an arbitrary value: they can only be incremented or decremented by any arbitrary value. For this reason, INSERT doesn't support Counter Column because you cannot "insert" a value into a Counter Column. You can only

How to auto generate uuid in cassandra CQL 3 command line

亡梦爱人 提交于 2019-11-30 03:06:21
Just learning cassandra, is there a way to insert a UUID using CQL, ie create table stuff (uid uuid primary key, name varchar); insert into stuff (name) values('my name'); // fails insert into stuff (uid, name) values(1, 'my name'); // fails Can you do something like insert into stuff (uid, name) values(nextuid(), 'my name'); Richard You can with time uuids (type 1 UUID) using the now() function e.g. insert into stuff (uid, name) values(now(), 'my name'); Works with uid or timeuuid. It generates a "guaranteed unique" UID value, which also contains the timestamp so is sortable by time. There