KurtYoung commented on a change in pull request #10098: 
[FLINK-14326][FLINK-14324][table] Support to apply watermark assigner in planner
URL: https://github.com/apache/flink/pull/10098#discussion_r343550652
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/WatermarkGeneratorCodeGenerator.scala
 ##########
 @@ -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.table.planner.codegen
+
+import org.apache.flink.configuration.Configuration
+import org.apache.flink.table.api.TableConfig
+import org.apache.flink.table.planner.calcite.FlinkTypeFactory
+import org.apache.flink.table.planner.codegen.CodeGenUtils.{BASE_ROW, newName}
+import org.apache.flink.table.planner.codegen.Indenter.toISC
+import org.apache.flink.table.runtime.generated.GeneratedWatermarkGenerator
+import org.apache.flink.table.runtime.operators.wmassigners.WatermarkGenerator
+import org.apache.flink.table.types.logical.{RowType, TimestampType}
+
+import org.apache.calcite.rex.RexNode
+
+/**
+  * A code generator for generating [[WatermarkGenerator]]s.
+  */
+object WatermarkGeneratorCodeGenerator {
+
+  def generateWatermarkGenerator(
+      config: TableConfig,
+      inputType: RowType,
+      watermarkExpr: RexNode): GeneratedWatermarkGenerator = {
+    // validation
+    val watermarkOutputType = 
FlinkTypeFactory.toLogicalType(watermarkExpr.getType)
+    if (!watermarkOutputType.equals(new TimestampType(3))) {
 
 Review comment:
   With precision less than 3, we still can get millisecond from the field. For 
example, if the precision is 0, the millisecond we get will always end up in 
`000`

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


With regards,
Apache Git Services

Reply via email to