OUT
- type of inputClasspublic abstract class CassandraInputFormatBase<OUT> extends RichInputFormat<OUT,InputSplit> implements NonParallelInput
RichInputFormat
to read data from Apache Cassandra and generate a custom Cassandra annotated object.Modifier and Type | Field and Description |
---|---|
protected com.datastax.driver.core.Cluster |
cluster |
protected org.slf4j.Logger |
logger |
protected String |
query |
protected com.datastax.driver.core.Session |
session |
Constructor and Description |
---|
CassandraInputFormatBase(String query,
ClusterBuilder builder) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all resources used.
|
void |
configure(Configuration parameters)
Configures this input format.
|
InputSplit[] |
createInputSplits(int minNumSplits)
Creates the different splits of the input that can be processed in parallel.
|
InputSplitAssigner |
getInputSplitAssigner(InputSplit[] inputSplits)
Gets the type of the input splits that are processed by this input format.
|
BaseStatistics |
getStatistics(BaseStatistics cachedStatistics)
Gets the basic statistics from the input described by this format.
|
closeInputFormat, getRuntimeContext, openInputFormat, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextRecord, open, reachedEnd
protected final org.slf4j.Logger logger
protected final String query
protected transient com.datastax.driver.core.Cluster cluster
protected transient com.datastax.driver.core.Session session
public CassandraInputFormatBase(String query, ClusterBuilder builder)
public void configure(Configuration parameters)
InputFormat
This method is always called first on a newly instantiated input format.
configure
in interface InputFormat<OUT,InputSplit>
parameters
- The configuration with all parameters (note: not the Flink config but the TaskConfig).public BaseStatistics getStatistics(BaseStatistics cachedStatistics)
InputFormat
When this method is called, the input format it guaranteed to be configured.
getStatistics
in interface InputFormat<OUT,InputSplit>
cachedStatistics
- The statistics that were cached. May be null.public InputSplit[] createInputSplits(int minNumSplits)
InputFormat
When this method is called, the input format it guaranteed to be configured.
createInputSplits
in interface InputFormat<OUT,InputSplit>
createInputSplits
in interface InputSplitSource<InputSplit>
minNumSplits
- The minimum desired number of splits. If fewer are created, some parallel
instances may remain idle.public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits)
InputFormat
getInputSplitAssigner
in interface InputFormat<OUT,InputSplit>
getInputSplitAssigner
in interface InputSplitSource<InputSplit>
public void close()
close
in interface InputFormat<OUT,InputSplit>
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.