org.apache.flink.api.java.typeutils.InputTypeConfigurable Java Examples
The following examples show how to use
org.apache.flink.api.java.typeutils.InputTypeConfigurable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataStream.java From flink with Apache License 2.0 | 6 votes |
/** * Adds the given sink to this DataStream. Only streams with sinks added * will be executed once the {@link StreamExecutionEnvironment#execute()} * method is called. * * @param sinkFunction * The object containing the sink's invoke function. * @return The closed DataStream. */ public DataStreamSink<T> addSink(SinkFunction<T> sinkFunction) { // read the output type of the input Transform to coax out errors about MissingTypeInfo transformation.getOutputType(); // configure the type if needed if (sinkFunction instanceof InputTypeConfigurable) { ((InputTypeConfigurable) sinkFunction).setInputType(getType(), getExecutionConfig()); } StreamSink<T> sinkOperator = new StreamSink<>(clean(sinkFunction)); DataStreamSink<T> sink = new DataStreamSink<>(this, sinkOperator); getExecutionEnvironment().addOperator(sink.getTransformation()); return sink; }
Example #2
Source File: DataStream.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Adds the given sink to this DataStream. Only streams with sinks added * will be executed once the {@link StreamExecutionEnvironment#execute()} * method is called. * * @param sinkFunction * The object containing the sink's invoke function. * @return The closed DataStream. */ public DataStreamSink<T> addSink(SinkFunction<T> sinkFunction) { // read the output type of the input Transform to coax out errors about MissingTypeInfo transformation.getOutputType(); // configure the type if needed if (sinkFunction instanceof InputTypeConfigurable) { ((InputTypeConfigurable) sinkFunction).setInputType(getType(), getExecutionConfig()); } StreamSink<T> sinkOperator = new StreamSink<>(clean(sinkFunction)); DataStreamSink<T> sink = new DataStreamSink<>(this, sinkOperator); getExecutionEnvironment().addOperator(sink.getTransformation()); return sink; }
Example #3
Source File: DataStream.java From flink with Apache License 2.0 | 6 votes |
/** * Adds the given sink to this DataStream. Only streams with sinks added * will be executed once the {@link StreamExecutionEnvironment#execute()} * method is called. * * @param sinkFunction * The object containing the sink's invoke function. * @return The closed DataStream. */ public DataStreamSink<T> addSink(SinkFunction<T> sinkFunction) { // read the output type of the input Transform to coax out errors about MissingTypeInfo transformation.getOutputType(); // configure the type if needed if (sinkFunction instanceof InputTypeConfigurable) { ((InputTypeConfigurable) sinkFunction).setInputType(getType(), getExecutionConfig()); } StreamSink<T> sinkOperator = new StreamSink<>(clean(sinkFunction)); DataStreamSink<T> sink = new DataStreamSink<>(this, sinkOperator); getExecutionEnvironment().addOperator(sink.getTransformation()); return sink; }
Example #4
Source File: BucketingSink.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (this.writerTemplate instanceof InputTypeConfigurable) { ((InputTypeConfigurable) writerTemplate).setInputType(type, executionConfig); } }
Example #5
Source File: OutputFormatSinkFunction.java From flink with Apache License 2.0 | 5 votes |
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (format instanceof InputTypeConfigurable) { InputTypeConfigurable itc = (InputTypeConfigurable) format; itc.setInputType(type, executionConfig); } }
Example #6
Source File: DataSet.java From flink with Apache License 2.0 | 5 votes |
/** * Emits a DataSet using an {@link OutputFormat}. This method adds a data sink to the program. * Programs may have multiple data sinks. A DataSet may also have multiple consumers (data sinks * or transformations) at the same time. * * @param outputFormat The OutputFormat to process the DataSet. * @return The DataSink that processes the DataSet. * * @see OutputFormat * @see DataSink */ public DataSink<T> output(OutputFormat<T> outputFormat) { Preconditions.checkNotNull(outputFormat); // configure the type if needed if (outputFormat instanceof InputTypeConfigurable) { ((InputTypeConfigurable) outputFormat).setInputType(getType(), context.getConfig()); } DataSink<T> sink = new DataSink<>(this, outputFormat, getType()); this.context.registerDataSink(sink); return sink; }
Example #7
Source File: BucketingSink.java From flink with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (this.writerTemplate instanceof InputTypeConfigurable) { ((InputTypeConfigurable) writerTemplate).setInputType(type, executionConfig); } }
Example #8
Source File: OutputFormatSinkFunction.java From flink with Apache License 2.0 | 5 votes |
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (format instanceof InputTypeConfigurable) { InputTypeConfigurable itc = (InputTypeConfigurable) format; itc.setInputType(type, executionConfig); } }
Example #9
Source File: DataSet.java From flink with Apache License 2.0 | 5 votes |
/** * Emits a DataSet using an {@link OutputFormat}. This method adds a data sink to the program. * Programs may have multiple data sinks. A DataSet may also have multiple consumers (data sinks * or transformations) at the same time. * * @param outputFormat The OutputFormat to process the DataSet. * @return The DataSink that processes the DataSet. * * @see OutputFormat * @see DataSink */ public DataSink<T> output(OutputFormat<T> outputFormat) { Preconditions.checkNotNull(outputFormat); // configure the type if needed if (outputFormat instanceof InputTypeConfigurable) { ((InputTypeConfigurable) outputFormat).setInputType(getType(), context.getConfig()); } DataSink<T> sink = new DataSink<>(this, outputFormat, getType()); this.context.registerDataSink(sink); return sink; }
Example #10
Source File: BucketingSink.java From flink with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (this.writerTemplate instanceof InputTypeConfigurable) { ((InputTypeConfigurable) writerTemplate).setInputType(type, executionConfig); } }
Example #11
Source File: StreamGraph.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public <IN, OUT> void addOperator( Integer vertexID, String slotSharingGroup, @Nullable String coLocationGroup, StreamOperator<OUT> operatorObject, TypeInformation<IN> inTypeInfo, TypeInformation<OUT> outTypeInfo, String operatorName) { if (operatorObject instanceof StoppableStreamSource) { addNode(vertexID, slotSharingGroup, coLocationGroup, StoppableSourceStreamTask.class, operatorObject, operatorName); } else if (operatorObject instanceof StreamSource) { addNode(vertexID, slotSharingGroup, coLocationGroup, SourceStreamTask.class, operatorObject, operatorName); } else { addNode(vertexID, slotSharingGroup, coLocationGroup, 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); } }
Example #12
Source File: OutputFormatSinkFunction.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (format instanceof InputTypeConfigurable) { InputTypeConfigurable itc = (InputTypeConfigurable) format; itc.setInputType(type, executionConfig); } }
Example #13
Source File: DataSet.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Emits a DataSet using an {@link OutputFormat}. This method adds a data sink to the program. * Programs may have multiple data sinks. A DataSet may also have multiple consumers (data sinks * or transformations) at the same time. * * @param outputFormat The OutputFormat to process the DataSet. * @return The DataSink that processes the DataSet. * * @see OutputFormat * @see DataSink */ public DataSink<T> output(OutputFormat<T> outputFormat) { Preconditions.checkNotNull(outputFormat); // configure the type if needed if (outputFormat instanceof InputTypeConfigurable) { ((InputTypeConfigurable) outputFormat).setInputType(getType(), context.getConfig()); } DataSink<T> sink = new DataSink<>(this, outputFormat, getType()); this.context.registerDataSink(sink); return sink; }
Example #14
Source File: RollingSink.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (this.writerTemplate instanceof InputTypeConfigurable) { ((InputTypeConfigurable) writerTemplate).setInputType(type, executionConfig); } }
Example #15
Source File: SimpleOperatorFactory.java From flink with Apache License 2.0 | 4 votes |
@Override public boolean isInputTypeConfigurable() { return operator instanceof InputTypeConfigurable; }
Example #16
Source File: SimpleOperatorFactory.java From flink with Apache License 2.0 | 4 votes |
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { ((InputTypeConfigurable) operator).setInputType(type, executionConfig); }
Example #17
Source File: SimpleOperatorFactory.java From flink with Apache License 2.0 | 4 votes |
@Override public boolean isInputTypeConfigurable() { return operator instanceof InputTypeConfigurable; }
Example #18
Source File: SimpleOperatorFactory.java From flink with Apache License 2.0 | 4 votes |
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { ((InputTypeConfigurable) operator).setInputType(type, executionConfig); }