Quantcast
Channel: DataStax Support Forums » Recent Topics
Viewing all articles
Browse latest Browse all 387

jonusko on "Mapping CQL3 composite keys to Hive?"

$
0
0

Using DSE 3.0 and CQL 3, how do you map a table that uses composite keys into a Hive table? The C* table looks like:

CREATE TABLE test
key1 varchar,
key2 timestamp,
key3 varchar,
col4 varchar,
col5 varchar,
PRIMARY KEY (key1, key2, key3)
);

Hive would have something like:

CREATE EXTERNAL TABLE hive_test (
key1 string,
key2 timestamp,
key3 string,
col4 string,
col5 string
) STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
WITH SERDEPROPERTIES (
"cassandra.cf.name" = "test",
"cassandra.columns.mapping" = ":key, key2, key3, col4, col5")
TBLPROPERTIES ("cassandra.ks.name" = "test_db");

I know the above example does not work. I am just trying to show that I wanted a straight mapping from C* to Hive but using composite keys in C* so I can retrieve key1 in a time range (key2) using C* APIs. For Hive, I just want to do normal SQL like queries.


Viewing all articles
Browse latest Browse all 387

Trending Articles