Y
- public abstract class AbstractColumnFamilyOutputFormat<K,Y>
extends org.apache.hadoop.mapreduce.OutputFormat<K,Y>
implements org.apache.hadoop.mapred.OutputFormat<K,Y>
ColumnFamilyOutputFormat
acts as a Hadoop-specific
OutputFormat that allows reduce tasks to store keys (and corresponding
values) as Cassandra rows (and respective columns) in a given
ColumnFamily.
As is the case with the ColumnFamilyInputFormat
, you need to set the
Keyspace and ColumnFamily in your
Hadoop job Configuration. The ConfigHelper
class, through its
ConfigHelper.setOutputColumnFamily(org.apache.hadoop.conf.Configuration, java.lang.String)
method, is provided to make this
simple.
For the sake of performance, this class employs a lazy write-back caching mechanism, where its record writer batches mutations created based on the reduce's inputs (in a task-specific map), and periodically makes the changes official by sending a batch mutate request to Cassandra.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BATCH_THRESHOLD |
static java.lang.String |
QUEUE_SIZE |
Constructor and Description |
---|
AbstractColumnFamilyOutputFormat() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkOutputSpecs(org.apache.hadoop.conf.Configuration conf) |
void |
checkOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem,
org.apache.hadoop.mapred.JobConf job)
Deprecated.
|
void |
checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)
Check for validity of the output-specification for the job.
|
static org.apache.cassandra.thrift.Cassandra.Client |
createAuthenticatedClient(java.lang.String host,
int port,
org.apache.hadoop.conf.Configuration conf)
Connects to the given server:port and returns a client based on the given socket that points to the configured
keyspace, and is logged in with the configured credentials.
|
org.apache.hadoop.mapreduce.OutputCommitter |
getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context)
The OutputCommitter for this format does not write any data to the DFS.
|
public static final java.lang.String BATCH_THRESHOLD
public static final java.lang.String QUEUE_SIZE
public void checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)
protected void checkOutputSpecs(org.apache.hadoop.conf.Configuration conf)
@Deprecated public void checkOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job) throws java.io.IOException
public org.apache.hadoop.mapreduce.OutputCommitter getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException, java.lang.InterruptedException
public static org.apache.cassandra.thrift.Cassandra.Client createAuthenticatedClient(java.lang.String host, int port, org.apache.hadoop.conf.Configuration conf) throws java.lang.Exception
host
- fully qualified host name to connect toport
- RPC port of the serverconf
- a job configurationjava.lang.Exception
- set of thrown exceptions may be implementation defined,
depending on the used transport factoryCopyright © 2013 The Apache Software Foundation