twalthr commented on a change in pull request #8062: [FLINK-11884][table]
Implement expression resolution on top of new Expressions
URL: https://github.com/apache/flink/pull/8062#discussion_r275307872
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/logical/groupWindows.scala
##########
@@ -104,54 +94,45 @@ case class SlidingGroupWindow(
alias,
timeField) {
- override def resolveExpressions(
- resolve: (PlannerExpression) => PlannerExpression): LogicalWindow =
- SlidingGroupWindow(
- resolve(alias),
- resolve(timeField),
- resolve(size),
- resolve(slide))
-
- override def validate(tableEnv: TableEnvironment): ValidationResult =
- super.validate(tableEnv).orElse(
- tableEnv match {
+ override def validate(isStreaming: Boolean): Unit =
+ isStreaming match {
// check size
case _ if !isTimeIntervalLiteral(size) && !isRowCountLiteral(size) =>
- ValidationFailure(
+ throw new ValidationException(
"Sliding window expects size literal of type Interval of
Milliseconds " +
"or Interval of Rows.")
// check slide
case _ if !isTimeIntervalLiteral(slide) && !isRowCountLiteral(slide) =>
- ValidationFailure(
+ throw new ValidationException(
"Sliding window expects slide literal of type Interval of
Milliseconds " +
"or Interval of Rows.")
// check same type of intervals
case _ if isTimeIntervalLiteral(size) != isTimeIntervalLiteral(slide)
=>
- ValidationFailure("Sliding window expects same type of size and
slide.")
+ throw new ValidationException("Sliding window expects same type of
size and slide.")
// check time attribute
- case _: StreamTableEnvironment if !isTimeAttribute(timeField) =>
- ValidationFailure(
+ case true if !isTimeAttribute(timeField) =>
+ throw new ValidationException(
"Sliding window expects a time attribute for grouping in a stream
environment.")
- case _: BatchTableEnvironment
+ case false
if !(isTimePoint(timeField.resultType) ||
isLong(timeField.resultType)) =>
- ValidationFailure(
+ throw new ValidationException(
"Sliding window expects a time attribute for grouping in a stream
environment.")
// check row intervals on event-time
- case _: StreamTableEnvironment
+ case true
if isRowCountLiteral(size) && isRowtimeAttribute(timeField) =>
- ValidationFailure(
+ throw new ValidationException(
"Event-time grouping windows on row intervals in a stream
environment " +
"are currently not supported.")
case _ =>
- ValidationSuccess
+ // validation successful
}
- )
+
Review comment:
nit: remove empty line
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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