fapaul commented on a change in pull request #17759:
URL: https://github.com/apache/flink/pull/17759#discussion_r747296972



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecSink.java
##########
@@ -322,7 +323,8 @@ private int deriveSinkParallelism(
                     sinkFunction, env, inputTransform, rowtimeFieldIndex, 
sinkParallelism);
         } else if (runtimeProvider instanceof SinkProvider) {
             return new SinkTransformation<>(
-                    inputTransform,
+                    createTimestampTransformation(

Review comment:
       I do not think this fully fixes the problem. Currently, users can also 
use the `DataStreamSinkProvider` in conjunction with the unified sinks i.e. 
buffered upsert Kafka but in these cases we do not apply the `TimestampOperator`
   
   

##########
File path: 
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sink/TimestampOperator.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.runtime.operators.sink;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.operators.TableStreamOperator;
+
+/**
+ * Operator which sets the timestamp on the StreamRecord from the 
corresponding column of each row.
+ */
+@Internal
+public class TimestampOperator extends TableStreamOperator<RowData>

Review comment:
       Maybe name this class `TimestampAPIConverterOperator` because afaik the 
main motivation is essential converting the Table API timestamp representation 
to the one used by the DataStream API.

##########
File path: 
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/sink/TimestampOperator.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.runtime.operators.sink;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.operators.TableStreamOperator;
+
+/**
+ * Operator which sets the timestamp on the StreamRecord from the 
corresponding column of each row.
+ */
+@Internal
+public class TimestampOperator extends TableStreamOperator<RowData>
+        implements OneInputStreamOperator<RowData, RowData> {
+
+    private final int rowtimeIndex;
+
+    public TimestampOperator(int rowtimeIndex) {
+        this.rowtimeIndex = rowtimeIndex;
+    }
+
+    @Override
+    public void processElement(StreamRecord<RowData> element) throws Exception 
{
+        final RowData rowData = element.getValue();

Review comment:
       Not sure if it is possible that the `StreamRecord` already has a 
timestamp but we should definitely `warn` the user if there is a timestamp 
column and a timestamp in the `StreamRecord`.
   
   @twalthr Do we also need to handle the `-Long.MAX_VALUE` timestamp which is 
set if there is no watermark strategy set?




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


Reply via email to