OUT
- The type of elements returned by this function.@Internal public class FromElementsGeneratorFunction<OUT> extends Object implements GeneratorFunction<Long,OUT>, OutputTypeConfigurable<OUT>
This generator function serializes the elements using Flink's type information. That way, any object transport using Java serialization will not be affected by the serializability of the elements.
Constructor and Description |
---|
FromElementsGeneratorFunction(TypeInformation<OUT> typeInfo,
ExecutionConfig config,
Iterable<OUT> elements) |
FromElementsGeneratorFunction(TypeInformation<OUT> typeInfo,
OUT... elements) |
Modifier and Type | Method and Description |
---|---|
static <OUT> void |
checkIterable(Iterable<OUT> elements,
Class<?> viewedAs)
Verifies that all elements in the iterable are non-null, and are of the given class, or a
subclass thereof.
|
TypeSerializer<OUT> |
getSerializer() |
OUT |
map(Long nextIndex) |
void |
open(SourceReaderContext readerContext)
Initialization method for the function.
|
void |
setOutputType(TypeInformation<OUT> outTypeInfo,
ExecutionConfig executionConfig)
Is called by the
org.apache.flink.streaming.api.graph.StreamGraph#addOperator(Integer,
String, StreamOperator, TypeInformation, TypeInformation, String) method when the org.apache.flink.streaming.api.graph.StreamGraph is generated. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
@SafeVarargs public FromElementsGeneratorFunction(TypeInformation<OUT> typeInfo, OUT... elements)
public FromElementsGeneratorFunction(TypeInformation<OUT> typeInfo, ExecutionConfig config, Iterable<OUT> elements)
@VisibleForTesting @Nullable public TypeSerializer<OUT> getSerializer()
public void open(SourceReaderContext readerContext) throws Exception
GeneratorFunction
open
in interface GeneratorFunction<Long,OUT>
Exception
public OUT map(Long nextIndex) throws Exception
map
in interface GeneratorFunction<Long,OUT>
Exception
public void setOutputType(TypeInformation<OUT> outTypeInfo, ExecutionConfig executionConfig)
OutputTypeConfigurable
org.apache.flink.streaming.api.graph.StreamGraph#addOperator(Integer,
String, StreamOperator, TypeInformation, TypeInformation, String)
method when the org.apache.flink.streaming.api.graph.StreamGraph
is generated. The method is called with the
output TypeInformation
which is also used for the org.apache.flink.streaming.runtime.tasks.StreamTask
output serializer.setOutputType
in interface OutputTypeConfigurable<OUT>
outTypeInfo
- Output type information of the org.apache.flink.streaming.runtime.tasks.StreamTask
executionConfig
- Execution configurationpublic static <OUT> void checkIterable(Iterable<OUT> elements, Class<?> viewedAs)
OUT
- The generic type of the iterable to be checked.elements
- The iterable to check.viewedAs
- The class to which the elements must be assignable to.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.