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

    https://github.com/apache/flink/pull/3743#discussion_r112652207
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/call.scala
 ---
    @@ -49,6 +59,160 @@ case class Call(functionName: String, args: 
Seq[Expression]) extends Expression
     }
     
     /**
    +  * Over expression for calcite over transform.
    +  *
    +  * @param agg             over-agg expression
    +  * @param overWindowAlias over window alias
    +  * @param overWindow      over window
    +  */
    +case class OverCall(
    +    agg: Aggregation,
    +    overWindowAlias: Expression,
    +    var overWindow: OverWindow = null) extends Expression {
    +
    +  override private[flink] def toRexNode(implicit relBuilder: RelBuilder): 
RexNode = {
    +
    +    val rexBuilder = relBuilder.getRexBuilder
    +
    +    val operator: SqlAggFunction = agg.getSqlAggFunction()
    +
    +    val relDataType = relBuilder
    +      .getTypeFactory.asInstanceOf[FlinkTypeFactory]
    +      .createTypeFromTypeInfo(agg.resultType)
    +
    +    val aggExprs: util.ArrayList[RexNode] = new util.ArrayList[RexNode]()
    +    val aggChildName = agg.child.asInstanceOf[ResolvedFieldReference].name
    +
    +    aggExprs.add(relBuilder.field(aggChildName))
    +
    +    val orderKeys: ImmutableList.Builder[RexFieldCollation] =
    +      new ImmutableList.Builder[RexFieldCollation]()
    +
    +    val sets: util.HashSet[SqlKind] = new util.HashSet[SqlKind]()
    +    val orderName = 
overWindow.orderBy.asInstanceOf[UnresolvedFieldReference].name
    +
    +    val rexNode =
    +      if (orderName.equalsIgnoreCase("rowtime")) {
    --- End diff --
    
    We cannot properly distinguish batch and streaming here.
    If a batch table has a column `rowtime`, this will fail.
    
    We could replace the `UnresolvedFieldReference` for `rowtime` / `proctime` 
by  `RowTime` / `ProcTime` `TimeIndicator` expression in 
`ProjectionTranslator.translateOverWindow()`.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to