Spring Data Cassandra - Making a Column Static - spring-data-cassandra

I am looking into the Spring Data provider for Cassandra and don't see a way to specify a column as static when a table includes clustering keys. Am I missing something?

There's no CQL generation support for static columns. Do you want to file an issue at https://jira.spring.io/browse/DATACASS?
For now, create the CQL of this table yourself.

Related

Dynamic Column Family in Datastax Cassandra

As there is a way to create dynamic column family in Cassandra through CQL 3 i.e using a composite primary key with COMPACT STORAGE.
For inserting data in dynamic column family (wide rows), which will be efficient way, datastax java driver or Thrift API’s.
As I'm using Datastax, and Datastax highly suggest using non-compact tables for new developments, inspite non-compact table are less "compact" internally, then how should I need to create dynamic column family, with COMPACT STORAGE or without COMPACT STORAGE.
Please suggest.
To answer your other question. You should stay away from the Thrift API for new development. If you use the Trift API you will miss out on all the great features of CQL 3 including:
Compound Keys
Collections & other types
Usability
Use the latest Datastax Java driver!
(2.1)
http://www.datastax.com/documentation/developer/java-driver/2.1/java-driver/whatsNew2.html
To do similar things to what you previously did with a "wide row" you will want to use a compound primary key that includes clustering columns.
CREATE TABLE data (
sensor_id int,
collected_at timestamp,
volts float,
PRIMARY KEY (sensor_id, collected_at)
);
See the following blog posts for more information on using wide partitions in CQL3 and how old thrift terminology relates to what you can do in CQL3:
http://www.datastax.com/dev/blog/does-cql-support-dynamic-columns-wide-rows
http://www.datastax.com/dev/blog/cql3-for-cassandra-experts
http://www.datastax.com/dev/blog/thrift-to-cql3

Which is write efficient "create table with option With compact storage" or "create table with option With clustering order storage"?

I am designing schema for a read as as well Write critical Problem statement.
Which will be more write and read efficient Create table with compact storage or create table with the Clustering order.
As per my requirement Clustering order helps me to safe some time during reading. but at the same time i fear that it could effect the insertion.
can any one tell ?
Compact storage is for backwards compatibility with thrift apps..I'd recommend avoiding it. From the official docs:
Using compact storage¶
The compact storage directive is used for backward compatibility of
old applications with CQL. Use the directive to store data in the
legacy (Thrift) storage engine format. To take advantage of CQL
capabilities, do not use this directive in new applications.
CREATE TABLE sblocks ( block_id uuid, subblock_id uuid, data
blob, PRIMARY KEY (block_id, subblock_id) ) WITH COMPACT STORAGE;
Using the compact storage directive prevents you from defining more
than one column that is not part of a compound primary key. A compact
table using a primary key that is not compound can have multiple
columns that are not part of the primary key.
A compact table that uses a compound primary key must define at least
one clustering column. Columns cannot be added nor removed after
creation of a compact table. Unless you specify WITH COMPACT STORAGE,
CQL creates a table with non-compact storage.¶
A table with a Clustering order really has no penalty over a table without. Writes always go into the memtable (since Cassandra uses a log structured storage) and is more or less like a line of log. Clustering keys really help while reading to seek to the right CQL row inside a partition. Searching using a Clustering key is very efficient and is really the recommended way to do things.
I don't have the rep for a comment so thought I'd leave this here for anyone who stumbles upon this question and is using C* >= 3.0.
Cassandra's storage engine was re-factored in version 3. Data is now stored more compactly on disk by default. There is no benefit in using the COMPACT STORAGE option, besides backwards thrift compatibility, in fact it should be avoided altogether.
DataStax Reference

Hector support for CQL3 specific features (Partition & Clustering keys) and Compact Storage option

I'm trying to leverage a specific feature of Apache Cassandra CQL3, which is partition and clustering keys for tables which are created with compact storage option.
For Eg.
CREATE TABLE EMPLOYEE(id uuid, name text, field text, value text, primary key(id, name , field )) with compact storage;
I've created the table via CQL3 and i;m able to insert rows successfully using the Hector API.
But I couldn't find right set of options in the hector api to create the table itself as i require.
To elaborate a little bit more:
In ColumnFamilyDefinition.java i couldnt see an option for setting storage option (as compact storage) and In ColumnDefinition.java, i couldnt find the option to say that this column is part of the Partition and Clustering Keys
Could you please give me an idea of whether i can use Hector for this (i.e. Creating table) or not and if i can do that, what are the options that i need to provide?
If you are not tied to Hector, you could look into the DataStax Java Driver which was created to use CQL3 and Cassandra's binary protocol.

Is it possible to alter Cassandra static column family in production without downtime?

In case we need to add new columns to existing Cassandra (version 1.2) static column family in production, can we do it without downtime provided we have hundreds of nodes and multiple data centers?
It would be disappointing if not possible.
In the case of adding columns, all that is really going on with an 'ALTER' statement in CQL is some meta-data entry in the system tables. No data files are being re-written.
This meta-data is then used for validation from both the API transports and compaction.
If you really have that big a cluster, you will need to wait a short while for the change to propagate - cqlsh blocks until this happens, IIRC.

Enabling Caching in Cassandra Column family through hector-API?

I am using hector-core1.0-5 from prettyprint for connecting to cassandra. Using this API I am able to create the keyspace. But I am unable to find the method which configures the "caching" property of column family. So as default it assigns "KEYS_ONLY" as "caching" value for all column families created. I wan to change this property value to "ALL" so that I can use both the key cache and row cache in cassandra.My cassandra version1.2.0. Anyone help me in finding the way to alter the "caching" property at the time a keyspace is created.
There is not support for get or set caching in ColumnFamilyDefinition interface. Hector community has to patch the code.
No idea about Hector as such. But we are using Playorm for Cassandra and it uses Caches like hibernate. Read more information at http://buffalosw.com/wiki/Caching-in-Playorm/.

Resources