Airblader commented on a change in pull request #15369:
URL: https://github.com/apache/flink/pull/15369#discussion_r601232999



##########
File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/sinks/DataStreamDynamicTableSink.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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.table.planner.sinks;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.streaming.api.operators.AbstractStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+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.transformations.OneInputTransformation;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.RuntimeConverter;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.sink.SinkTransformationProvider;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.operators.TableStreamOperator;
+import org.apache.flink.table.runtime.typeutils.ExternalTypeInfo;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.utils.LogicalTypeChecks;
+
+/**
+ * A {@link DynamicTableSink} defining how to emit a {@link 
org.apache.flink.table.api.Table} to a {@link 
org.apache.flink.streaming.api.datastream.DataStream}.
+ */
+@Internal
+public class DataStreamDynamicTableSink implements DynamicTableSink {
+    private final ChangelogMode changelogMode;
+    private final DataType dataType;
+
+    public DataStreamDynamicTableSink(ChangelogMode changelogMode, DataType 
dataType) {
+        this.changelogMode = changelogMode;
+        this.dataType = dataType;
+    }
+
+    @Override
+    public ChangelogMode getChangelogMode(ChangelogMode requestedMode) {
+        return changelogMode;
+    }
+
+    @Override
+    public SinkRuntimeProvider getSinkRuntimeProvider(Context sinkContext) {
+        final DataStructureConverter converter = 
sinkContext.createDataStructureConverter(dataType);
+
+        return new SinkTransformationProvider() {
+            @Override
+            public Transformation<Object> 
getTransformation(SinkTransformationProvider.Context transformationContext) {
+                final SinkTransformationOperatorFactory
+                        operatorFactory =
+                        new SinkTransformationOperatorFactory(

Review comment:
       I tried using the SimpleOperatorFactory, but that causes exceptions and 
I don't understand what it does differently. :-/




-- 
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]


Reply via email to