kl0u commented on a change in pull request #13824: URL: https://github.com/apache/flink/pull/13824#discussion_r514211286
########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/SinkTransformation.java ########## @@ -0,0 +1,91 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package org.apache.flink.streaming.api.transformations; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.connector.sink.Sink; +import org.apache.flink.api.dag.Transformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.streaming.api.operators.ChainingStrategy; + +import org.apache.flink.shaded.guava18.com.google.common.collect.Lists; + +import java.util.Collections; +import java.util.List; + +import static org.apache.flink.util.Preconditions.checkNotNull; + +/** + * This Transformation represents a {@link org.apache.flink.api.connector.sink.Sink}. + * + * @param <InputT> The input type of the {@link org.apache.flink.api.connector.sink.Writer} + * @param <CommT> The committable type of the {@link org.apache.flink.api.connector.sink.Writer} + * @param <WriterStateT> The state type of the {@link org.apache.flink.api.connector.sink.Writer} + * @param <GlobalCommT> The global committable type of the {@link org.apache.flink.api.connector.sink.GlobalCommitter} + */ +@Internal +public class SinkTransformation<InputT, CommT, WriterStateT, GlobalCommT> extends PhysicalTransformation<Object> { + + private final Transformation<InputT> input; + + private final Sink<InputT, CommT, WriterStateT, GlobalCommT> sink; + + private ChainingStrategy chainingStrategy; + + public SinkTransformation( + Transformation<InputT> input, + Sink<InputT, CommT, WriterStateT, GlobalCommT> sink, + String name, + int parallelism) { + super(name, TypeExtractor.getForClass(Object.class), parallelism); + this.input = checkNotNull(input); + this.sink = checkNotNull(sink); + } + + @Override + public void setChainingStrategy(ChainingStrategy strategy) { + chainingStrategy = strategy; Review comment: We can add a `checkNotNull` here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
