LadyForest commented on code in PR #22222:
URL: https://github.com/apache/flink/pull/22222#discussion_r1144164688


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/metadata/FlinkRelMdWindowProperties.scala:
##########
@@ -252,13 +254,40 @@ class FlinkRelMdWindowProperties private extends 
MetadataHandler[FlinkMetadata.W
   }
 
   def getWindowProperties(
-      rel: StreamPhysicalWindowAggregate,
+      rel: StreamPhysicalWindowAggregateBase,
       mq: RelMetadataQuery): RelWindowProperties = {
+    rel match {
+      case _: StreamPhysicalWindowAggregate =>
+        val aggregate = rel.asInstanceOf[StreamPhysicalWindowAggregate]
+        getWindowAggregateWindowProperties(
+          aggregate.grouping.length + aggregate.aggCalls.size(),
+          aggregate.namedWindowProperties,
+          aggregate.windowing.getWindow,
+          aggregate.windowing.getTimeAttributeType
+        )
+      case _: StreamPhysicalGlobalWindowAggregate =>
+        val aggregate = rel.asInstanceOf[StreamPhysicalGlobalWindowAggregate]
+        getWindowAggregateWindowProperties(
+          aggregate.grouping.length + aggregate.aggCalls.size(),
+          aggregate.namedWindowProperties,
+          aggregate.windowing.getWindow,
+          aggregate.windowing.getTimeAttributeType
+        )
+      case _ =>

Review Comment:
   > Can the input of window join be `StreamPhysicalGroupWindowAggregateBase`? 
If the answer is yes, it may need to add the case of 
`StreamPhysicalGroupWindowAggregateBase`. Or the same thing will happen if the 
inputs of window join are `StreamPhysicalGroupWindowAggregateBase`.
   
   According to the doc[1], I think the input of window join cannot be a legacy 
window group aggregate. The join on top of the group window aggregate will be 
translated to the regular join, other than window join.
   > Windowing TVFs is a replacement of legacy [Grouped Window 
Functions](https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/#group-window-aggregation-deprecated).
 Windowing TVFs is more SQL standard compliant and more powerful to support 
complex window-based computations, e.g. Window TopN, Window Join. However, 
[Grouped Window 
Functions](https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/#group-window-aggregation)
 can only support Window Aggregation.
   
   [1] 
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-tvf/



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to