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

    https://github.com/apache/flink/pull/4488#discussion_r131704138
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/StreamTableEnvironment.scala
 ---
    @@ -502,6 +500,68 @@ abstract class StreamTableEnvironment(
       }
     
       /**
    +    * Injects markers for time indicator fields into the field indexes.
    +    * A rowtime indicator is represented as -1, a proctime indicator as -2.
    +    *
    +    * @param fieldIndexes The field indexes into which the time indicators 
markers are injected.
    +    * @param rowtime An optional rowtime indicator
    +    * @param proctime An optional proctime indicator
    +    * @return An adjusted array of field indexes.
    +    */
    +  private def adjustFieldIndexes(
    +    fieldIndexes: Array[Int],
    +    rowtime: Option[(Int, String)],
    +    proctime: Option[(Int, String)]): Array[Int] = {
    +
    +    // inject rowtime field
    +    val withRowtime = if (rowtime.isDefined) {
    +      fieldIndexes.patch(rowtime.get._1, Seq(-1), 0) // -1 indicates 
rowtime
    +    } else {
    +      fieldIndexes
    +    }
    +
    +    // inject proctime field
    +    val withProctime = if (proctime.isDefined) {
    +      withRowtime.patch(proctime.get._1, Seq(-2), 0) // -2 indicates 
proctime
    +    } else {
    +      withRowtime
    +    }
    +
    +    withProctime
    +  }
    +
    +  /**
    +    * Injects names of time indicator fields into the list of field names.
    +    *
    +    * @param fieldNames The array of field names into which the time 
indicator field names are
    +    *                   injected.
    +    * @param rowtime An optional rowtime indicator
    +    * @param proctime An optional proctime indicator
    +    * @return An adjusted array of field names.
    +    */
    +  private def adjustFieldNames(
    +    fieldNames: Array[String],
    +    rowtime: Option[(Int, String)],
    +    proctime: Option[(Int, String)]): Array[String] = {
    +
    +    // inject rowtime field
    +    val withRowtime = if (rowtime.isDefined) {
    --- End diff --
    
    we could use pattern matching here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to