1

I'm fairly new to Cassandra. I'm using hadoop to bulk load data into a cassandra cluster using CqlOutputFormat. I'm unable to find sufficient examples in internet to tailor it to my usecase.

I'm specifically using it to insert data into the cluster using the statement ,

insert into pinseries (pin, timeseries) values(?, ?)

I'm not sure how the context.write() should look like to make this work. There seems to be enough examples to see how it should work for an update statement (The wordcount from examples will do). But can someone tell me how to use that in insert mode?

Vishnu Prathish
  • 369
  • 4
  • 15

1 Answers1

1

The CqlRecordWriter used by the CqlOutputFormat doesn't support insert statements only update statements so you will need to use update to insert your data. Along the lines of:

update pinseries set timeseries = ? where pin = ?

I'm assuming that pin is your primary key.

mikea
  • 6,537
  • 19
  • 36
  • Thanks for that. It seems to be a widely underused outputformat. I'm still a bit skeptic about using these bulk formats against copying data after the job manually using sstableloader. – Vishnu Prathish Mar 19 '15 at 14:06