use of org.apache.flink.api.java.typeutils.InputTypeConfigurable in project flink by apache.
the class StreamGraph method addOperator.
public <IN, OUT> void addOperator(Integer vertexID, String slotSharingGroup, StreamOperator<OUT> operatorObject, TypeInformation<IN> inTypeInfo, TypeInformation<OUT> outTypeInfo, String operatorName) {
if (operatorObject instanceof StoppableStreamSource) {
addNode(vertexID, slotSharingGroup, StoppableSourceStreamTask.class, operatorObject, operatorName);
} else if (operatorObject instanceof StreamSource) {
addNode(vertexID, slotSharingGroup, SourceStreamTask.class, operatorObject, operatorName);
} else {
addNode(vertexID, slotSharingGroup, OneInputStreamTask.class, operatorObject, operatorName);
}
TypeSerializer<IN> inSerializer = inTypeInfo != null && !(inTypeInfo instanceof MissingTypeInfo) ? inTypeInfo.createSerializer(executionConfig) : null;
TypeSerializer<OUT> outSerializer = outTypeInfo != null && !(outTypeInfo instanceof MissingTypeInfo) ? outTypeInfo.createSerializer(executionConfig) : null;
setSerializers(vertexID, inSerializer, null, outSerializer);
if (operatorObject instanceof OutputTypeConfigurable && outTypeInfo != null) {
@SuppressWarnings("unchecked") OutputTypeConfigurable<OUT> outputTypeConfigurable = (OutputTypeConfigurable<OUT>) operatorObject;
// sets the output type which must be know at StreamGraph creation time
outputTypeConfigurable.setOutputType(outTypeInfo, executionConfig);
}
if (operatorObject instanceof InputTypeConfigurable) {
InputTypeConfigurable inputTypeConfigurable = (InputTypeConfigurable) operatorObject;
inputTypeConfigurable.setInputType(inTypeInfo, executionConfig);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Vertex: {}", vertexID);
}
}
use of org.apache.flink.api.java.typeutils.InputTypeConfigurable in project flink by apache.
the class OutputFormatSinkFunction method setInputType.
@Override
public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
if (format instanceof InputTypeConfigurable) {
InputTypeConfigurable itc = (InputTypeConfigurable) format;
itc.setInputType(type, executionConfig);
}
}
use of org.apache.flink.api.java.typeutils.InputTypeConfigurable in project flink by apache.
the class CommonExecSink method createSinkFunctionTransformation.
private Transformation<?> createSinkFunctionTransformation(SinkFunction<RowData> sinkFunction, StreamExecutionEnvironment env, Transformation<RowData> inputTransformation, int rowtimeFieldIndex, TransformationMetadata transformationMetadata, int sinkParallelism) {
final SinkOperator operator = new SinkOperator(env.clean(sinkFunction), rowtimeFieldIndex);
if (sinkFunction instanceof InputTypeConfigurable) {
((InputTypeConfigurable) sinkFunction).setInputType(getInputTypeInfo(), env.getConfig());
}
final Transformation<?> transformation = new LegacySinkTransformation<>(inputTransformation, transformationMetadata.getName(), SimpleOperatorFactory.of(operator), sinkParallelism);
transformationMetadata.fill(transformation);
return transformation;
}
Aggregations