Github user wuchong commented on a diff in the pull request: https://github.com/apache/flink/pull/3266#discussion_r99987780 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/dataset/DataSetWindowAggregate.scala --- @@ -271,19 +269,46 @@ class DataSetWindowAggregate( isInputCombined = true) mappedInput - .groupBy(groupingKeys: _*) - .sortGroup(rowTimeFieldPos, Order.ASCENDING) - .combineGroup(combineGroupFunction) - .groupBy(groupingKeys: _*) - .sortGroup(windowStartPos, Order.ASCENDING) - .sortGroup(windowEndPos, Order.ASCENDING) - .reduceGroup(groupReduceFunction) - .returns(rowTypeInfo) - .name(aggregateOperatorName) - .asInstanceOf[DataSet[Any]] + .groupBy(groupingKeys: _*) + .sortGroup(rowTimeFieldPos, Order.ASCENDING) + .combineGroup(combineGroupFunction) + .groupBy(groupingKeys: _*) + .sortGroup(windowStartPos, Order.ASCENDING) + .sortGroup(windowEndPos, Order.ASCENDING) + .reduceGroup(groupReduceFunction) + .returns(rowTypeInfo) + .name(aggregateOperatorName) + .asInstanceOf[DataSet[Any]] + + } else { + // non-grouping window + val preMapPartitionFunction = createDataSetWindowAggregationMapPartitionFunction( + window, + namedAggregates, + inputType) + + val mapPartitionFunction = createDataSetWindowAggregationMapPartitionFunction( + window, + namedAggregates, + inputType, + rowRelDataType, + namedProperties, + isPreMapPartition = false, + isInputCombined = true) + + mappedInput.sortPartition(rowTimeFieldPos, Order.ASCENDING).setParallelism(1) + .mapPartition(preMapPartitionFunction).setParallelism(1) --- End diff -- Please indent every operator method in a single line. I think the first `sortPartition` and the first `mapPartition` can be run in parallel, do not need to set `setParallelism(1)`. Otherwise, the performance will be poorer than the approach of non-incremental agg & non-grouping. What do you think ?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---