Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5240#discussion_r164168602
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/descriptors/Rowtime.scala
 ---
    @@ -0,0 +1,131 @@
    +/*
    + * 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.descriptors
    +
    +import org.apache.flink.table.api.Types
    +import 
org.apache.flink.table.descriptors.NormalizedProperties.{normalizeTimestampExtractor,
 normalizeWatermarkStrategy}
    +import org.apache.flink.table.sources.tsextractors.{ExistingField, 
StreamRecordTimestamp, TimestampExtractor}
    +import org.apache.flink.table.sources.wmstrategies.{AscendingTimestamps, 
BoundedOutOfOrderTimestamps, PreserveWatermarks, WatermarkStrategy}
    +
    +import scala.collection.mutable
    +
    +/**
    +  * Rowtime descriptor for describing an event time attribute in the 
schema.
    +  */
    +class Rowtime extends Descriptor {
    +
    +  private var timestampExtractor: Option[TimestampExtractor] = None
    +  private var watermarkStrategy: Option[WatermarkStrategy] = None
    +
    +  /**
    +    * Sets a built-in timestamp extractor that converts an existing 
[[Long]] or
    +    * [[Types.SQL_TIMESTAMP]] field into the rowtime attribute.
    +    *
    +    * @param fieldName The field to convert into a rowtime attribute.
    +    */
    +  def timestampFromField(fieldName: String): Rowtime = {
    +    timestampExtractor = Some(new ExistingField(fieldName))
    +    this
    +  }
    +
    +  /**
    +    * Sets a built-in timestamp extractor that converts the assigned 
timestamp from
    +    * a DataStream API record into the rowtime attribute.
    +    *
    +    * Note: This extractor only works in streaming environments.
    +    */
    +  def timestampFromDataStream(): Rowtime = {
    +    timestampExtractor = Some(new StreamRecordTimestamp)
    +    this
    +  }
    +
    +  /**
    +    * Sets a custom timestamp extractor to be used for the rowtime 
attribute.
    +    *
    +    * @param extractor The [[TimestampExtractor]] to extract the rowtime 
attribute
    +    *                  from the physical type.
    +    */
    +  def timestampFromExtractor(extractor: TimestampExtractor): Rowtime = {
    --- End diff --
    
    `timestampsFromExtractor()`


---

Reply via email to