snuyanzin commented on code in PR #25362:
URL: https://github.com/apache/flink/pull/25362#discussion_r1768355815


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/FlinkCalciteSqlValidator.java:
##########
@@ -373,20 +375,30 @@ protected void addToSelectList(
         final SqlOperator operator = call.getOperator();
 
         if (operator instanceof SqlWindowTableFunction) {
-            if (explicitTableArgs.stream().allMatch(Objects::isNull)) {
+            if (tableArgs.stream().allMatch(Objects::isNull)) {
                 return rewritten;
             }
 
+            final boolean isSessionWindow = isSessionWindow(operator);
             final List<SqlIdentifier> descriptors =
                     call.getOperandList().stream()
                             
.flatMap(FlinkCalciteSqlValidator::extractDescriptors)
                             .collect(Collectors.toList());
 
             for (int i = 0; i < call.operandCount(); i++) {
-                final SqlIdentifier tableArg = explicitTableArgs.get(i);
+                final SqlIdentifier tableArg = tableArgs.get(i);
                 if (tableArg != null) {
                     final SqlNode opReplacement = new 
ExplicitTableSqlSelect(tableArg, descriptors);
-                    if (call.operand(i).getKind() == 
SqlKind.ARGUMENT_ASSIGNMENT) {
+                    if (isSessionWindow) {

Review Comment:
   otherwise SESSION window will lose `PARTITION BY` in plans
   as covered by
   
https://github.com/apache/flink/blob/0e373b20d917a9bcd2b00e32d3ff09b353aef728/flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/plan/stream/sql/WindowTableFunctionTest.scala#L293-L305



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