public static class CQLSSTableWriter.Builder
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
CQLSSTableWriter |
build() |
CQLSSTableWriter.Builder |
forTable(java.lang.String schema)
The schema (CREATE TABLE statement) for the table for which sstable are to be created.
|
CQLSSTableWriter.Builder |
inDirectory(java.io.File directory)
The directory where to write the sstables (mandatory option).
|
CQLSSTableWriter.Builder |
inDirectory(java.lang.String directory)
The directory where to write the sstables.
|
CQLSSTableWriter.Builder |
sorted()
Creates a CQLSSTableWriter that expects sorted inputs.
|
CQLSSTableWriter.Builder |
using(java.lang.String insertStatement)
The INSERT statement defining the order of the values to add for a given CQL row.
|
CQLSSTableWriter.Builder |
withBufferSizeInMB(int size)
The size of the buffer to use.
|
CQLSSTableWriter.Builder |
withPartitioner(IPartitioner partitioner)
The partitioner to use.
|
public CQLSSTableWriter.Builder inDirectory(java.lang.String directory)
This is a mandatory option.
directory
- the directory to use, which should exists and be writable.java.lang.IllegalArgumentException
- if directory
doesn't exist or is not writable.public CQLSSTableWriter.Builder inDirectory(java.io.File directory)
This is a mandatory option.
directory
- the directory to use, which should exists and be writable.java.lang.IllegalArgumentException
- if directory
doesn't exist or is not writable.public CQLSSTableWriter.Builder forTable(java.lang.String schema)
Please note that the provided CREATE TABLE statement must use a fully-qualified table name, one that include the keyspace name.
This is a mandatory option.
schema
- the schema of the table for which sstables are to be created.java.lang.IllegalArgumentException
- if schema
is not a valid CREATE TABLE statement
or does not have a fully-qualified table name.public CQLSSTableWriter.Builder withPartitioner(IPartitioner partitioner)
By default, Murmur3Partitioner
will be used. If this is not the partitioner used
by the cluster for which the SSTables are created, you need to use this method to
provide the correct partitioner.
partitioner
- the partitioner to use.public CQLSSTableWriter.Builder using(java.lang.String insertStatement)
Please note that the provided INSERT statement must use a fully-qualified table name, one that include the keyspace name. Morewover, said statement must use bind variables since it is those bind variables that will be bound to values by the resulting writer.
This is a mandatory option, and this needs to be called after foTable().
insertStatement
- an insertion statement that defines the order
of column values to use.java.lang.IllegalArgumentException
- if insertStatement
is not a valid insertion
statement, does not have a fully-qualified table name or have no bind variables.public CQLSSTableWriter.Builder withBufferSizeInMB(int size)
This defines how much data will be buffered before being written as a new SSTable. This correspond roughly to the data size that will have the created sstable.
The default is 128MB, which should be reasonable for a 1GB heap. If you experience OOM while using the writer, you should lower this value.
size
- the size to use in MB.public CQLSSTableWriter.Builder sorted()
If this option is used, the resulting writer will expect rows to be added in SSTable sorted order (and an exception will be thrown if that is not the case during insertion). The SSTable sorted order means that rows are added such that their partition key respect the partitioner order and for a given partition, that the rows respect the clustering columns order.
You should thus only use this option is you know that you can provide the rows in order, which is rarely the case. If you can provide the rows in order however, using this sorted might be more efficient.
Note that if used, some option like withBufferSizeInMB will be ignored.
public CQLSSTableWriter build()
Copyright © 2014 The Apache Software Foundation