Database Reference
In-Depth Information
// set update CQL and row key
job.getConfiguration().set("row_key",
"key");
String query = "UPDATE " +
KEYSPACE_NAME + "." + COLUMN_FAMILY + " SET
count = ? ";
CqlConfigHelper.setOutputCql(job.getConfiguration(),
query);
//set cql outputformat class
job.setOutputFormatClass(CqlOutputFormat.class);
3.
The CQL3-based aggregator is:
public static class TweetCQLAggregator
extends
org.apache.hadoop.mapreduce.Reducer<Text,
IntWritable, Map<String,ByteBuffer>,
List<ByteBuffer>>
{
private static Map<String,ByteBuffer>
keys = new HashMap<>();
/* (non-Javadoc)
* @see
org.apache.hadoop.mapreduce.Reducer#reduce(KEYIN,
java.lang.Iterable,org.apache.hadoop.mapreduce.Reducer.Context)
*/
public void reduce(Text word,
Iterable<IntWritable> values, Context
context) throws IOException,
InterruptedException
{
int sum = 0;
for (IntWritable val : values)
sum += val.get();
Search WWH ::




Custom Search