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-scalableDataGenerator
that 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)
boolean
hasNext()
static SequenceGenerator<Integer>
intGenerator(int start, int end)
static SequenceGenerator<Long>
longGenerator(long start, long end)
void
open(String name, FunctionInitializationContext context, RuntimeContext runtimeContext)
Open and initialize state forDataGenerator
.static SequenceGenerator<Short>
shortGenerator(short start, short end)
void
snapshotState(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, FunctionInitializationContext context, RuntimeContext runtimeContext) throws Exception
Description copied from interface:DataGenerator
Open and initialize state forDataGenerator
. SeeCheckpointedFunction.initializeState(org.apache.flink.runtime.state.FunctionInitializationContext)
.- Specified by:
open
in interfaceDataGenerator<T>
- Parameters:
name
- The state ofDataGenerator
should related to this name, make sure the name of state is different.- Throws:
Exception
-
snapshotState
public void snapshotState(FunctionSnapshotContext context) throws Exception
Description copied from interface:DataGenerator
Snapshot state forDataGenerator
. SeeCheckpointedFunction.snapshotState(org.apache.flink.runtime.state.FunctionSnapshotContext)
.- Specified by:
snapshotState
in 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)
-
-