Package org.apache.cassandra.hadoop.cql3
Class CqlBulkOutputFormat
- java.lang.Object
-
- org.apache.hadoop.mapreduce.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>
-
- org.apache.cassandra.hadoop.cql3.CqlBulkOutputFormat
-
- All Implemented Interfaces:
org.apache.hadoop.mapred.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>
public class CqlBulkOutputFormat extends org.apache.hadoop.mapreduce.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>> implements org.apache.hadoop.mapred.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>TheCqlBulkOutputFormatacts as a Hadoop-specific OutputFormat that allows reduce tasks to store keys (and corresponding bound variable values) as CQL rows (and respective columns) in a given table.As is the case with the
CqlOutputFormat, you need to set the prepared statement in your Hadoop job Configuration. TheCqlConfigHelperclass, through itsorg.apache.cassandra.hadoop.ConfigHelper#setOutputPreparedStatementmethod, is provided to make this simple. you need to set the Keyspace. TheConfigHelperclass, through itsConfigHelper.setOutputColumnFamily(org.apache.hadoop.conf.Configuration, java.lang.String)method, is provided to make this simple.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCqlBulkOutputFormat.NullOutputCommitter
-
Constructor Summary
Constructors Constructor Description CqlBulkOutputFormat()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcheckOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job)Deprecated.voidcheckOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)static booleangetDeleteSourceOnSuccess(org.apache.hadoop.conf.Configuration conf)static java.util.Collection<java.lang.String>getIgnoreHosts(org.apache.hadoop.conf.Configuration conf)Get the hosts to ignore as a collection of stringsorg.apache.hadoop.mapreduce.OutputCommittergetOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context)CqlBulkRecordWritergetRecordWriter(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job, java.lang.String name, org.apache.hadoop.util.Progressable progress)Deprecated.CqlBulkRecordWritergetRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context)Get theRecordWriterfor the given task.static java.lang.StringgetTableForAlias(org.apache.hadoop.conf.Configuration conf, java.lang.String alias)static java.lang.StringgetTableInsertStatement(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily)static java.lang.StringgetTableSchema(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily)static voidsetDeleteSourceOnSuccess(org.apache.hadoop.conf.Configuration conf, boolean deleteSrc)static voidsetIgnoreHosts(org.apache.hadoop.conf.Configuration conf, java.lang.String ignoreNodesCsv)Set the hosts to ignore as comma delimited values.static voidsetIgnoreHosts(org.apache.hadoop.conf.Configuration conf, java.lang.String... ignoreNodes)Set the hosts to ignore.static voidsetTableAlias(org.apache.hadoop.conf.Configuration conf, java.lang.String alias, java.lang.String columnFamily)static voidsetTableInsertStatement(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily, java.lang.String insertStatement)static voidsetTableSchema(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily, java.lang.String schema)
-
-
-
Method Detail
-
getRecordWriter
@Deprecated public CqlBulkRecordWriter getRecordWriter(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job, java.lang.String name, org.apache.hadoop.util.Progressable progress) throws java.io.IOException
Deprecated.Fills the deprecated OutputFormat interface for streaming.- Specified by:
getRecordWriterin interfaceorg.apache.hadoop.mapred.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>- Throws:
java.io.IOException
-
getRecordWriter
public CqlBulkRecordWriter getRecordWriter(org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException, java.lang.InterruptedException
Get theRecordWriterfor the given task.- Specified by:
getRecordWriterin classorg.apache.hadoop.mapreduce.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>- Parameters:
context- the information about the current task.- Returns:
- a
RecordWriterto write the output for the job. - Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
checkOutputSpecs
public void checkOutputSpecs(org.apache.hadoop.mapreduce.JobContext context)
- Specified by:
checkOutputSpecsin classorg.apache.hadoop.mapreduce.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>
-
checkOutputSpecs
@Deprecated public void checkOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job) throws java.io.IOExceptionDeprecated.Fills the deprecated OutputFormat interface for streaming.- Specified by:
checkOutputSpecsin interfaceorg.apache.hadoop.mapred.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>- Throws:
java.io.IOException
-
getOutputCommitter
public org.apache.hadoop.mapreduce.OutputCommitter getOutputCommitter(org.apache.hadoop.mapreduce.TaskAttemptContext context) throws java.io.IOException, java.lang.InterruptedException- Specified by:
getOutputCommitterin classorg.apache.hadoop.mapreduce.OutputFormat<java.lang.Object,java.util.List<java.nio.ByteBuffer>>- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
setTableSchema
public static void setTableSchema(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily, java.lang.String schema)
-
setTableInsertStatement
public static void setTableInsertStatement(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily, java.lang.String insertStatement)
-
getTableSchema
public static java.lang.String getTableSchema(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily)
-
getTableInsertStatement
public static java.lang.String getTableInsertStatement(org.apache.hadoop.conf.Configuration conf, java.lang.String columnFamily)
-
setDeleteSourceOnSuccess
public static void setDeleteSourceOnSuccess(org.apache.hadoop.conf.Configuration conf, boolean deleteSrc)
-
getDeleteSourceOnSuccess
public static boolean getDeleteSourceOnSuccess(org.apache.hadoop.conf.Configuration conf)
-
setTableAlias
public static void setTableAlias(org.apache.hadoop.conf.Configuration conf, java.lang.String alias, java.lang.String columnFamily)
-
getTableForAlias
public static java.lang.String getTableForAlias(org.apache.hadoop.conf.Configuration conf, java.lang.String alias)
-
setIgnoreHosts
public static void setIgnoreHosts(org.apache.hadoop.conf.Configuration conf, java.lang.String ignoreNodesCsv)Set the hosts to ignore as comma delimited values. Data will not be bulk loaded onto the ignored nodes.- Parameters:
conf- job configurationignoreNodesCsv- a comma delimited list of nodes to ignore
-
setIgnoreHosts
public static void setIgnoreHosts(org.apache.hadoop.conf.Configuration conf, java.lang.String... ignoreNodes)Set the hosts to ignore. Data will not be bulk loaded onto the ignored nodes.- Parameters:
conf- job configurationignoreNodes- the nodes to ignore
-
getIgnoreHosts
public static java.util.Collection<java.lang.String> getIgnoreHosts(org.apache.hadoop.conf.Configuration conf)
Get the hosts to ignore as a collection of strings- Parameters:
conf- job configuration- Returns:
- the nodes to ignore as a collection of stirngs
-
-