Class SequenceGenerator<T>
java.lang.Object
org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator<T>
- All Implemented Interfaces:
Serializable,Iterator<T>,DataGenerator<T>
A stateful, re-scalable
DataGenerator that emits each number from a given interval
exactly once, possibly in parallel.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSequenceGenerator(long start, long end) Creates a DataGenerator that emits all numbers from the given interval exactly once. -
Method Summary
Modifier and TypeMethodDescriptionstatic SequenceGenerator<BigDecimal>bigDecimalGenerator(int start, int end, int precision, int scale) static SequenceGenerator<Byte>byteGenerator(byte start, byte end) static SequenceGenerator<Double>doubleGenerator(int start, int end) static SequenceGenerator<Float>floatGenerator(short start, short end) booleanhasNext()static SequenceGenerator<Integer>intGenerator(int start, int end) static SequenceGenerator<Long>longGenerator(long start, long end) voidopen(String name, org.apache.flink.runtime.state.FunctionInitializationContext context, org.apache.flink.api.common.functions.RuntimeContext runtimeContext) Open and initialize state forDataGenerator.static SequenceGenerator<Short>shortGenerator(short start, short end) voidsnapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context) Snapshot state forDataGenerator.static SequenceGenerator<String>stringGenerator(long start, long end) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, next, remove
-
Field Details
-
valuesToEmit
-
-
Constructor Details
-
SequenceGenerator
public SequenceGenerator(long start, long end) Creates a DataGenerator that emits all numbers from the given interval exactly once.- Parameters:
start- Start of the range of numbers to emit.end- End of the range of numbers to emit.
-
-
Method Details
-
open
public void open(String name, org.apache.flink.runtime.state.FunctionInitializationContext context, org.apache.flink.api.common.functions.RuntimeContext runtimeContext) throws Exception Description copied from interface:DataGeneratorOpen and initialize state forDataGenerator. SeeCheckpointedFunction.initializeState(org.apache.flink.runtime.state.FunctionInitializationContext).- Specified by:
openin interfaceDataGenerator<T>- Parameters:
name- The state ofDataGeneratorshould related to this name, make sure the name of state is different.- Throws:
Exception
-
snapshotState
public void snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext context) throws Exception Description copied from interface:DataGeneratorSnapshot state forDataGenerator. SeeCheckpointedFunction.snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext).- Specified by:
snapshotStatein interfaceDataGenerator<T>- Throws:
Exception
-
hasNext
public boolean hasNext() -
longGenerator
-
intGenerator
-
shortGenerator
-
byteGenerator
-
floatGenerator
-
doubleGenerator
-
bigDecimalGenerator
public static SequenceGenerator<BigDecimal> bigDecimalGenerator(int start, int end, int precision, int scale) -
stringGenerator
-