1

After loading data from Oracle DB to Cassandra via Sqoop, I was able to view my data through both Cassandra and Hive. I was told that while doing so, 2 files would be generated for each, creating space issues. To resolve this, I dropped the table in Hive and created an external table and mapped it to my column family in Cassandra. But I am not able to view any data in the Hive table. I am using Datastax Enterprise 3.0.1. Using Sqoop, I migrated the table 'test' from Oracle DB to a Cassandra column family of the same name in the keyspace 'test_keyspace'. I am able to view the data through cassandra-cli using the command : list test;

Describing the column family in cqlsh gives me the following result:

CREATE TABLE test (
rowkey text PRIMARY KEY,
bar text,
gump bigint,
home text,
note text,
pay text
) WITH
comment='' AND
comparator=text AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
default_validation=text AND
min_compaction_threshold=4 AND
max_compaction_threshold=32 AND
replication_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND compression_parameters:stable_compression='SnappyCompressor';

The command i am using to create the Hive table is:

CREATE external TABLE test (
rowkey string,
bar string,
gump string,
home string,
note string,
pay string
)
STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
TBLPROPERTIES ( "cassandra.ks.name" = "test_keyspace" );

The table is listed when i type 'show tables' in Hive. But 'select * from test' shows all the values in the table as NULL, except the row key.

Would anyone know a solution?

Jenny D
  • 27,358
  • 21
  • 74
  • 110
nsa
  • 11
  • 1

1 Answers1

0

Try creating the table like this:

CREATE external TABLE test (
    rowkey string,
    bar string,
    gump string,
    home string,
    note string,
    pay string
)
STORED BY 'org.apache.hadoop.hive.cassandra.CassandraStorageHandler'
WITH SERDEPROPERTIES("cql.primarykey"="rowkey"
TBLPROPERTIES ( "cassandra.ks.name" = "test_keyspace", "cassandra.cql.type"="text, text, text, text, text, text" );
fuero
  • 9,413
  • 1
  • 35
  • 40