I'm trying to run Hive query over existing C* table.
Here is my C* table definition:
drop table IF EXISTS mydata.site_users;
CREATE TABLE IF NOT EXISTS appdata.site_users (
user_id text,
user_test_uuid uuid, --for testing purposes, if we can use it in queries, there could be some serde problems?
user_name text,
PRIMARY KEY (user_id)
);
Here is my external hive table definition:
CREATE EXTERNAL TABLE c_site_users(
user_id string, user_test_uuid binary, user_name string)
STORED BY 'org.apache.hadoop.hive.cassandra.cql3.CqlStorageHandler'
WITH SERDEPROPERTIES( "cassandra.ks.name" = "mydata",
"cassandra.cf.name" = "site_users",
"cql3.partition.key" = "user_id",
"cassandra.cql3.type" = "text, uuid, text"
);
I've inserted data into C* table using cqlsh:
cqlsh:appdata> select * from site_users;
user_id | user_name | user_test_uuid
---------+-----------+--------------------------------------
user2 | Ivan | 51569760-10e6-11e5-af86-23fdaf275fb9
user1 | Sergey | 51542660-10e6-11e5-af86-23fdaf275fb9
user3 | Johan | 5157a8d0-10e6-11e5-af86-23fdaf275fb9
(3 rows)
Now I try to run the same query using dse hive
vagrant@dsenode01:~$ dse hive
Logging initialized using configuration in file:/etc/dse/hive/hive-log4j.properties
hive> select * from c_site_users;
OK
Failed with exception java.io.IOException:java.io.IOException: com.datastax.driver.core.exceptions.UnavailableException: Not enough replica available for query at consistency LOCAL_ONE (1 required but only 0 alive)
Time taken: 13.297 seconds
So weird! C* table is ok, data is there, I can query it, but dse hive complains. What do I do wrong?
Ok, so answer is dead simple. I need to run dse with hadoop enabled on each node. I have 3 nodes and RF=1. And only one node was with HADOOP enabled. I turned HADOOP on all 3 nodes and it works from both sides: query external table backed by C* table and C* table directly since DSE implicitly updates metastore with C* tables.