slinkydeveloper commented on a change in pull request #18154:
URL: https://github.com/apache/flink/pull/18154#discussion_r772944203



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecPythonGroupWindowAggregate.java
##########
@@ -525,46 +537,145 @@ public StreamExecPythonGroupWindowAggregate(
         Class clazz =
                 CommonPythonUtil.loadClass(
                         
GENERAL_STREAM_PYTHON_GROUP_WINDOW_AGGREGATE_FUNCTION_OPERATOR_NAME);
+
+        boolean isRowTime = 
AggregateUtil.isRowtimeAttribute(window.timeAttribute());
+
         try {
-            Constructor<OneInputStreamOperator<RowData, RowData>> ctor =
-                    clazz.getConstructor(
-                            Configuration.class,
-                            RowType.class,
-                            RowType.class,
-                            PythonAggregateFunctionInfo[].class,
-                            DataViewUtils.DataViewSpec[][].class,
-                            int[].class,
-                            int.class,
-                            boolean.class,
-                            boolean.class,
-                            int.class,
-                            WindowAssigner.class,
-                            LogicalWindow.class,
-                            long.class,
-                            PlannerNamedWindowProperty[].class,
-                            ZoneId.class);
-            return ctor.newInstance(
-                    config,
-                    inputType,
-                    outputType,
-                    aggregateFunctions,
-                    dataViewSpecs,
-                    grouping,
-                    indexOfCountStar,
-                    generateUpdateBefore,
-                    countStarInserted,
-                    inputTimeFieldIndex,
-                    windowAssigner,
-                    window,
-                    allowance,
-                    namedWindowProperties,
-                    shiftTimeZone);
-        } catch (NoSuchMethodException
-                | IllegalAccessException
-                | InstantiationException
-                | InvocationTargetException e) {
+            if (window instanceof TumblingGroupWindow) {
+                ValueLiteralExpression size = ((TumblingGroupWindow) 
window).size();
+
+                Method create =
+                        clazz.getMethod(
+                                
GENERAL_STREAM_PYTHON_GROUP_WINDOW_AGGREGATE_FUNCTION_OPERATOR_CREATE_TUMBLING_WINDOW_METHOD_NAME,
+                                Configuration.class,
+                                RowType.class,
+                                RowType.class,
+                                PythonAggregateFunctionInfo[].class,
+                                DataViewUtils.DataViewSpec[][].class,
+                                int[].class,
+                                int.class,
+                                boolean.class,
+                                boolean.class,
+                                int.class,
+                                WindowAssigner.class,
+                                boolean.class,
+                                boolean.class,
+                                long.class,
+                                long.class,
+                                NamedWindowProperty[].class,
+                                ZoneId.class);
+                return (OneInputStreamOperator<RowData, RowData>)
+                        create.invoke(
+                                null,
+                                config,
+                                inputType,
+                                outputType,
+                                aggregateFunctions,
+                                dataViewSpecs,
+                                grouping,
+                                indexOfCountStar,
+                                generateUpdateBefore,
+                                countStarInserted,
+                                inputTimeFieldIndex,
+                                windowAssigner,
+                                isRowTime,
+                                AggregateUtil.hasTimeIntervalType(size),
+                                AggregateUtil.toDuration(size).toMillis(),

Review comment:
       I think the counting window is not exposed in Python, as there are no 
tests for it and this code clearly doesn't support it. This is the same logic 
as before, as the previous code when `size != null` invokes `toDuration`: 
https://github.com/apache/flink/pull/18154/commits/56689e8308fcd7545d091290584853b7f9fba5b2#diff-c0e724e6619276e7cfaa86aeb46efd9c29d752a48250b695eb23d94cb2ee9267L387
 




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