CqlBulkRecordWriter (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.hadoop.cql3

## Class CqlBulkRecordWriter

- java.lang.Object
- - org.apache.hadoop.mapreduce.RecordWriter<K,V>
  - - org.apache.cassandra.hadoop.AbstractBulkRecordWriter<java.lang.Object,java.util.List<java.nio.ByteBuffer>>
    - - org.apache.cassandra.hadoop.cql3.CqlBulkRecordWriter

- All Implemented Interfaces:
    org.apache.hadoop.mapred.RecordWriter<java.lang.Object,java.util.List<java.nio.ByteBuffer>>

      public class CqlBulkRecordWriter
      extends AbstractBulkRecordWriter<java.lang.Object,java.util.List<java.nio.ByteBuffer>>

  The `CqlBulkRecordWriter` maps the output <key, value> pairs to a Cassandra column family. In particular, it applies the binded variables in the value to the prepared statement, which it associates with the key, and in turn the responsible endpoint.

  Furthermore, this writer groups the cql queries by the endpoint responsible for the rows being affected. This allows the cql queries to be executed in parallel, directly to a responsible endpoint.

  See Also:
    `CqlBulkOutputFormat`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CqlBulkRecordWriter.ExternalClient`

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.hadoop.AbstractBulkRecordWriter

      `AbstractBulkRecordWriter.NullOutputHandler`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.hadoop.AbstractBulkRecordWriter

      `BUFFER_SIZE_IN_MB, bufferSize, conf, context, loader, MAX_FAILED_HOSTS, maxFailures, OUTPUT_LOCATION, progress, STREAM_THROTTLE_MBITS, writer`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `write(java.lang.Object key, java.util.List<java.nio.ByteBuffer> values)` The column values must correspond to the order in which they appear in the insert stored procedure.

    - ### Methods inherited from class org.apache.cassandra.hadoop.AbstractBulkRecordWriter

      `close, close, getOutputLocation`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### write

          public void write(java.lang.Object key,
                   java.util.List<java.nio.ByteBuffer> values)
                     throws java.io.IOException

      The column values must correspond to the order in which they appear in the insert stored procedure. Key is not used, so it can be null or any object.
      Specified by:
        `write` in interface `org.apache.hadoop.mapred.RecordWriter<java.lang.Object,java.util.List<java.nio.ByteBuffer>>`
      Specified by:
        `write` in class `org.apache.hadoop.mapreduce.RecordWriter<java.lang.Object,java.util.List<java.nio.ByteBuffer>>`
      Parameters:
        `key` - any object or null.
        `values` - the values to write.
      Throws:
        `java.io.IOException`

Copyright © 2014 The Apache Software Foundation