dylanhz commented on code in PR #27319:
URL: https://github.com/apache/flink/pull/27319#discussion_r2604933898


##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/batch/sql/agg/AggregateReduceGroupingTest.xml:
##########
@@ -381,7 +381,7 @@ LogicalProject(a4=[$0], b4=[$1], EXPR$2=[$3])
     </Resource>
     <Resource name="optimized exec plan">
       <![CDATA[
-HashWindowAggregate(groupBy=[a4], auxGrouping=[b4], 
window=[TumblingGroupWindow('w$, d4, 900000)], select=[a4, b4 AS EXPR$2, 
COUNT(c4) AS EXPR$2])
+HashWindowAggregate(groupBy=[a4], auxGrouping=[b4], 
window=[TumblingGroupWindow('w$, d4, 900000)], select=[a4, b4, COUNT(c4) AS 
EXPR$2])

Review Comment:
   Actually this pr is created to solve another issue.
   If we use an imperative agg function in 
AggregateReduceGroupingTestBase#testAggOnWindow3, like ARRAY_AGG, the incorrect 
field name will lead to a ValidationException.
   ```
     @Test
     def testAggOnWindow3(): Unit = {
       verifyPlan(
         "SELECT a4, c4, s, COUNT(b4) FROM " +
           "(SELECT a4, c4, ARRAY_AGG(b4) AS b4, " +
           "TUMBLE_START(d4, INTERVAL '15' MINUTE) AS s, " +
           "TUMBLE_END(d4, INTERVAL '15' MINUTE) AS e FROM T4 " +
           "GROUP BY a4, c4, TUMBLE(d4, INTERVAL '15' MINUTE)) t GROUP BY a4, 
c4, s")
     }
   ```
   ```
   Caused by: org.apache.flink.table.api.ValidationException: Field names must 
be unique. Found duplicates: [c4]
        at 
org.apache.flink.table.types.logical.RowType.validateFields(RowType.java:273)
        at org.apache.flink.table.types.logical.RowType.<init>(RowType.java:158)
        at org.apache.flink.table.types.logical.RowType.of(RowType.java:298)
        at org.apache.flink.table.types.logical.RowType.of(RowType.java:290)
   ```
   
   And the automated test is another topic. WDYT?



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