fapaul commented on a change in pull request #16701:
URL: https://github.com/apache/flink/pull/16701#discussion_r683643569
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/sink/AbstractStreamingCommitterHandler.java
##########
@@ -49,10 +49,10 @@
* @param <InputT> The input type of the {@link Committer}.
* @param <CommT> The committable type of the {@link Committer}.
*/
-abstract class AbstractStreamingCommitterOperator<InputT, CommT>
- extends AbstractStreamOperator<CommT> implements
OneInputStreamOperator<InputT, CommT> {
-
- private static final long serialVersionUID = 1L;
Review comment:
Is it safe to remove this line?
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/sink/SinkOperator.java
##########
@@ -32,25 +34,42 @@
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.ProcessingTimeService;
import org.apache.flink.util.UserCodeClassLoader;
+import org.apache.flink.util.function.BiFunctionWithException;
+import javax.annotation.Nullable;
+
+import java.io.IOException;
+import java.util.Collection;
import java.util.List;
import static org.apache.flink.util.Preconditions.checkNotNull;
/**
- * Abstract base class for operators that work with a {@link SinkWriter}.
+ * An operator that processes records to be written into a {@link
+ * org.apache.flink.api.connector.sink.Sink}. It also has a way to process
committables with the
+ * same parallelism or send them downstream to a {@link CommitterOperator}
with a different
+ * parallelism.
+ *
+ * <p>The operator may be part of a sink pipeline and is the first operator.
There are currently two
+ * ways this operator is used:
*
- * <p>Sub-classes are responsible for creating the specific {@link SinkWriter}
by implementing
- * {@link #createWriter()}.
+ * <ul>
+ * <li>In streaming mode, there is this operator with parallelism p
containing {@link
+ * org.apache.flink.api.connector.sink.SinkWriter} and {@link
+ * org.apache.flink.api.connector.sink.Committer} and a {@link
CommitterOperator} containing
+ * the {@link org.apache.flink.api.connector.sink.GlobalCommitter} with
parallelism 1.
+ * <li>In batch mode, there is this operator with parallelism p containing
{@link
+ * org.apache.flink.api.connector.sink.SinkWriter} and a {@link
CommitterOperator} containing
+ * the {@link org.apache.flink.api.connector.sink.Committer} and {@link
+ * org.apache.flink.api.connector.sink.GlobalCommitter} with parallelism
1.
+ * </ul>
*
- * @param <InputT> The input type of the {@link SinkWriter}.
- * @param <CommT> The committable type of the {@link SinkWriter}.
+ * @param <InputT> the type of the committable
+ * @param <CommT> the type of the committable (to send to downstream operators)
+ * @param <WriterStateT> the type of the writer state for stateful sinks
*/
-@Internal
-abstract class AbstractSinkWriterOperator<InputT, CommT> extends
AbstractStreamOperator<CommT>
- implements OneInputStreamOperator<InputT, CommT>, BoundedOneInput {
-
- private static final long serialVersionUID = 1L;
+public class SinkOperator<InputT, CommT, WriterStateT> extends
AbstractStreamOperator<byte[]>
Review comment:
`@Internal`?
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/sink/SinkOperatorFactory.java
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.runtime.operators.sink;
+
+import org.apache.flink.api.connector.sink.Committer;
+import org.apache.flink.api.connector.sink.Sink;
+import org.apache.flink.api.connector.sink.SinkWriter;
+import org.apache.flink.core.io.SimpleVersionedSerializer;
+import org.apache.flink.streaming.api.operators.AbstractStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+import org.apache.flink.streaming.api.operators.StreamOperatorParameters;
+import org.apache.flink.streaming.api.operators.YieldingOperatorFactory;
+
+import java.util.Optional;
+
+/**
+ * A {@link org.apache.flink.streaming.api.operators.StreamOperatorFactory}
for {@link
+ * SinkOperator}.
+ *
+ * @param <InputT> The input type of the {@link SinkWriter}.
+ * @param <CommT> The committable type of the {@link SinkWriter}.
+ * @param <WriterStateT> The type of the {@link SinkWriter Writer's} state.
+ */
Review comment:
`@Internal`
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/sink/CommitterOperatorFactory.java
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.runtime.operators.sink;
+
+import org.apache.flink.api.connector.sink.Committer;
+import org.apache.flink.api.connector.sink.GlobalCommitter;
+import org.apache.flink.api.connector.sink.Sink;
+import org.apache.flink.core.io.SimpleVersionedSerializer;
+import org.apache.flink.streaming.api.operators.AbstractStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.StreamOperator;
+import org.apache.flink.streaming.api.operators.StreamOperatorParameters;
+
+import java.io.IOException;
+import java.util.Optional;
+
+import static org.apache.flink.util.Preconditions.checkState;
+
+/**
+ * A {@link org.apache.flink.streaming.api.operators.StreamOperatorFactory}
for {@link
+ * CommitterOperator}.
+ *
+ * @param <CommT> the type of the committable
+ * @param <GlobalCommT> the type of the global committable
+ */
+public final class CommitterOperatorFactory<CommT, GlobalCommT>
Review comment:
Add `@Internal` annotation?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]