[
https://issues.apache.org/jira/browse/FLINK-6242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972869#comment-15972869
]
ASF GitHub Bot commented on FLINK-6242:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3735#discussion_r111978489
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GeneratedAggregations.scala
---
@@ -36,6 +36,15 @@ abstract class GeneratedAggregations extends Function {
def setAggregationResults(accumulators: Row, output: Row)
/**
+ * Calculates the results from accumulators, and set the results to the
output (with key offset)
+ *
+ * @param accumulators the accumulators (saved in a row) which contains
the current
+ * aggregated results
+ * @param output output results collected in a row
+ */
+ def setAggregationResultsWithKeyOffset(accumulators: Row, output: Row)
--- End diff --
I don't think we need to extend the `GeneratedAggregations` interface
(except for `resetAccumulators()`)
I would rather implement another code generation function that implements
the existing methods differently. This would mean to add another method to
`CodeGenerator` that generates the `GeneratedAggregations` interface suitable
for the DataSet aggregations.
- `setAggregationResultsWithKeyOffset` -> `setAggregationResults`
- `setKeyToOutput` -> `setForwardedFields`
- `accumulateWithKeyOffset` -> `accumulate`
- `createAccumulatorsAndSetToOutput` could be replaced by
`createAccumulators` (called once to create a reusable accumulators),
`resetAccumulators`, and `setAggregationResults` (if it sets the accumulators
instead of calling `AggFunction.getValue()`, see below)
- `copyAccumulatorsToBuffer` -> `setAggregationResults` (the accumulators
are partial aggregation results). This would mean we have two behaviors,
setting the final (`getValue()`) or the partial result (accumulator) for
`setAggregateResults()`. A simple flag during code gen would go for either the
final or the partial result.
> codeGen DataSet Goupingwindow Aggregates
> ----------------------------------------
>
> Key: FLINK-6242
> URL: https://issues.apache.org/jira/browse/FLINK-6242
> Project: Flink
> Issue Type: Sub-task
> Components: Table API & SQL
> Reporter: Shaoxuan Wang
> Assignee: Shaoxuan Wang
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)