KurtYoung commented on a change in pull request #11340: [Flink 14338] Upgrade 
Calcite version to 1.22 for Flink SQL
URL: https://github.com/apache/flink/pull/11340#discussion_r394740708
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/calcite/FlinkRelBuilder.scala
 ##########
 @@ -132,7 +134,23 @@ class FlinkRelBuilder(
       namedProperties: List[PlannerNamedWindowProperty],
       aggCalls: Iterable[AggCall]): RelBuilder = {
     // build logical aggregate
-    val aggregate = super.aggregate(groupKey, 
aggCalls).build().asInstanceOf[LogicalAggregate]
+
+    // Because of:
+    // [CALCITE-3763] RelBuilder.aggregate should prune unused fields from the 
input,
+    // if the input is a Project.
+    //
+    // the field can not be pruned if it is referenced by other expressions
+    // of the window aggregation(i.e. the TUMBLE_START/END).
+    // To solve this, we config the RelBuilder to forbidden this feature.
+    val aggregate = transform(
+      new UnaryOperator[RelBuilder.Config] {
+        override def apply(t: RelBuilder.Config)
+          : RelBuilder.Config = t.withPruneInputOfAggregate(false)
+      })
 
 Review comment:
   I think we shouldn't treat this special here. The whole `FlinkRelBuilder` 
should be configured disabling this thing.

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

Reply via email to