sunjincheng121 commented on a change in pull request #7664:
[FLINK-11449][table] Uncouple the Expression class from RexNodes.
URL: https://github.com/apache/flink/pull/7664#discussion_r255332130
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/scala/windows.scala
##########
@@ -143,7 +143,31 @@ case class OverWindowWithOrderBy(partitionBy:
Seq[Expression], orderBy: Expressi
* @param alias alias for this over window
* @return over window
*/
- def as(alias: String): OverWindow =
as(ExpressionParser.parseExpression(alias))
+ def as(alias: Expression): OverWindow = {
+ org.apache.flink.table.api.scala.OverWindow(
+ alias, partitionBy, orderBy, UNBOUNDED_RANGE, CURRENT_RANGE)
+ }
+}
+
+/**
+ * Over window is similar to the traditional OVER SQL.
+ */
+case class OverWindow(
Review comment:
The Refactoring of Expression causes the parameter type of the window API
under Scala to be changed from `PlannerExpression` to `APIExpression`. Since
the original java window api depends on the `ExpressionParser` and the Scala
API, and the ExprssionParser is not compatible with the new `APIExpression`,
Need to refactor the java window api, taking `TumbleWithSize` as an example:
The original window API:
```
Class TumbleWithSize(size: Expression) {
Def this(size: String) =
this(ExpressionParser.parseExpression(size))
}
```
Such an API depends on `ExpressionParser`, and the pass depends on `Calcite`.
The current window API:
Implementation of new TumbleWithSize(size) (split into two versions of Java
and scala):
```
// Java
Class TumbleWithSize(size: String) {
}
// Scala
Class TumbleWithSize(size: Expression) {
}
```
Such an API no longer relies on `ExpressionParser` and no longer passes
dependencies on `Calcite`.
Is that makes sense to you? or there are better suggestions ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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