Hello,
I'm trying to use ColumnFamilyOutputFormat to write to a Cassandra column family with composite columns from my reducer. Since Thrift is the only available API in this case (I wish it wasn't so), I followed an example outlined here: http://stackoverflow.com/questions/11801288/inserting-and-getting-from-cassandra-with-composite-key-invalidrequestexception
Unfortunately, I'm getting the following exception when I run the job:
12/12/17 21:37:32 INFO mapred.JobClient: Task Id : attempt_201212120944_0011_r_000003_2, Status : FAILED
java.io.IOException: InvalidRequestException(why:(String didn't validate.) [c8][txnspermember][12:345:ac0a2000-effb-11e1-c000-000000000000:1234:56789:somememberid:txn_date] failed validation)
at org.apache.cassandra.hadoop.ColumnFamilyRecordWriter$RangeClient.run(ColumnFamilyRecordWriter.java:316)
Caused by: InvalidRequestException(why:(String didn't validate.) [c8][txnspermember][12:345:ac0a2000-effb-11e1-c000-000000000000:1234:56789:somememberid:txn_date] failed validation)
at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20253)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:922)
at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:908)
at org.apache.cassandra.hadoop.ColumnFamilyRecordWriter$RangeClient.run(ColumnFamilyRecordWriter.java:308)
Note that "somememberid" is what I would expect my row key to be, yet it appears in the middle of the composite string for some reason.
My column family looks like this:
CREATE TABLE txnspermember (
member_id text,
org_id int,
brand_id int,
post_date 'TimeUUIDType',
merchant_id bigint,
offer_id bigint,
txn_id text,
agreed_rebate text,
catalog_id text,
cb_elig boolean,
cli_shr_pct double,
conv_rate double,
description text,
first_four int,
first_name text,
g_merchant_id bigint,
last_four int,
mbr_shr_pct double,
mcc bigint,
member_zip text,
mid text,
mn_shr_pct double,
rebate_amt double,
rebate_val double,
spend_amt double,
txn_date 'TimeUUIDType',
PRIMARY KEY (member_id, org_id, brand_id, post_date, merchant_id, offer_id, txn_id)
) WITH
comment='' AND
caching='KEYS_ONLY' AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';
