Class SequenceGenerator<T>
- java.lang.Object
-
- org.apache.flink.streaming.api.functions.source.datagen.SequenceGenerator<T>
-
- All Implemented Interfaces:
Serializable,Iterator<T>,DataGenerator<T>
@Experimental public abstract class SequenceGenerator<T> extends Object implements DataGenerator<T>
A stateful, re-scalableDataGeneratorthat emits each number from a given interval exactly once, possibly in parallel.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Deque<Long>valuesToEmit
-
Constructor Summary
Constructors Constructor Description SequenceGenerator(long start, long end)Creates a DataGenerator that emits all numbers from the given interval exactly once.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, next, remove
-
-
-
-
Method Detail
-
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 ExceptionDescription copied from interface:DataGeneratorSnapshot state forDataGenerator. SeeCheckpointedFunction.snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext).- Specified by:
snapshotStatein interfaceDataGenerator<T>- Throws:
Exception
-
longGenerator
public static SequenceGenerator<Long> longGenerator(long start, long end)
-
intGenerator
public static SequenceGenerator<Integer> intGenerator(int start, int end)
-
shortGenerator
public static SequenceGenerator<Short> shortGenerator(short start, short end)
-
byteGenerator
public static SequenceGenerator<Byte> byteGenerator(byte start, byte end)
-
floatGenerator
public static SequenceGenerator<Float> floatGenerator(short start, short end)
-
doubleGenerator
public static SequenceGenerator<Double> doubleGenerator(int start, int end)
-
bigDecimalGenerator
public static SequenceGenerator<BigDecimal> bigDecimalGenerator(int start, int end, int precision, int scale)
-
stringGenerator
public static SequenceGenerator<String> stringGenerator(long start, long end)
-
-