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

    https://github.com/apache/flink/pull/3743#discussion_r112499806
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamOverAggregate.scala
 ---
    @@ -93,28 +96,43 @@ class DataStreamOverAggregate(
     
         val orderKeys = overWindow.orderKeys.getFieldCollations
     
    -    if (orderKeys.size() != 1) {
    -      throw new TableException(
    -        "Unsupported use of OVER windows. The window can only be ordered 
by a single time column.")
    -    }
    -    val orderKey = orderKeys.get(0)
    +    val timeType = if (!orderKeys.isEmpty) {
    +      if (orderKeys.size() != 1) {
    +        throw new TableException(
    +          "Unsupported use of OVER windows. The window can only be ordered 
by a single time " +
    +            "column.")
    +      }
    +      val orderKey = orderKeys.get(0)
     
    -    if (!orderKey.direction.equals(ASCENDING)) {
    -      throw new TableException(
    -        "Unsupported use of OVER windows. The window can only be ordered 
in ASCENDING mode.")
    +      if (!orderKey.direction.equals(ASCENDING)) {
    +        throw new TableException(
    +          "Unsupported use of OVER windows. The window can only be ordered 
in ASCENDING mode.")
    +      }
    +      inputType
    +        .getFieldList
    +        .get(orderKey.getFieldIndex)
    +        .getValue.asInstanceOf[TimeModeType]
    +    } else {
    +      val it = logicWindow.constants.listIterator()
    +      if (it.hasNext) {
    +        val item = it.next().getValue
    +        if (item.isInstanceOf[NlsString]) {
    +          val value = item.asInstanceOf[NlsString].getValue
    +          if (value.equalsIgnoreCase("rowtime")) {
    +            new RowTimeType
    +          } else {
    +            new ProcTimeType
    +          }
    +        }
    +      }
         }
     
         val inputDS = 
input.asInstanceOf[DataStreamRel].translateToPlan(tableEnv)
     
         val generator = new CodeGenerator(
    -      tableEnv.getConfig,
    -      false,
    -      inputDS.getType)
    -
    -    val timeType = inputType
    -      .getFieldList
    -      .get(orderKey.getFieldIndex)
    -      .getValue
    +    tableEnv.getConfig,
    --- End diff --
    
    indent


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