OUT
- type of Tuplepublic class CassandraInputFormat<OUT extends Tuple> extends RichInputFormat<OUT,InputSplit> implements NonParallelInput
Tuple
.Constructor and Description |
---|
CassandraInputFormat(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.
|
OUT |
nextRecord(OUT reuse)
Reads the next record from the input.
|
void |
open(InputSplit ignored)
Opens a Session and executes the query.
|
boolean |
reachedEnd()
Method used to check if the end of the input is reached.
|
closeInputFormat, getRuntimeContext, openInputFormat, setRuntimeContext
public CassandraInputFormat(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 extends Tuple,InputSplit>
parameters
- The configuration with all parameters (note: not the Flink config but the TaskConfig).public BaseStatistics getStatistics(BaseStatistics cachedStatistics) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be configured.
getStatistics
in interface InputFormat<OUT extends Tuple,InputSplit>
cachedStatistics
- The statistics that were cached. May be null.IOException
public void open(InputSplit ignored) throws IOException
open
in interface InputFormat<OUT extends Tuple,InputSplit>
ignored
- IOException
public boolean reachedEnd() throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
reachedEnd
in interface InputFormat<OUT extends Tuple,InputSplit>
IOException
- Thrown, if an I/O error occurred.public OUT nextRecord(OUT reuse) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
nextRecord
in interface InputFormat<OUT extends Tuple,InputSplit>
reuse
- Object that may be reused.IOException
- Thrown, if an I/O error occurred.public InputSplit[] createInputSplits(int minNumSplits) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be configured.
createInputSplits
in interface InputFormat<OUT extends Tuple,InputSplit>
createInputSplits
in interface InputSplitSource<InputSplit>
minNumSplits
- The minimum desired number of splits. If fewer are created, some parallel
instances may remain idle.IOException
- Thrown, when the creation of the splits was erroneous.public InputSplitAssigner getInputSplitAssigner(InputSplit[] inputSplits)
InputFormat
getInputSplitAssigner
in interface InputFormat<OUT extends Tuple,InputSplit>
getInputSplitAssigner
in interface InputSplitSource<InputSplit>
public void close() throws IOException
close
in interface InputFormat<OUT extends Tuple,InputSplit>
IOException
- Thrown, if the input could not be closed properly.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.