Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-5915] [table] forward the entire aggregate ArgList to aggregate runtime functions #3647

Closed
wants to merge 1 commit into from

Conversation

shaoxuan-wang
Copy link
Contributor

This PR partially solved "FLINK-5915 Add support for the aggregate on multi fields".
The roadmap of UDAGG would be 1. codeGen all the runtime aggregate functions; 2. add UDAGG tableAPI interface.
I would like to kick this PR off earlier as: a) we can finalize the runtime function while doing the codeGen; b) as more and more (over) aggregates are implemented, it would be good if we can finalize the interface and share library to the stage (as we planned) as earlier as possible.

Note that: though the entire aggregate ArgList is forwarded to the runtime function, for the functions that have not been codeGened, we will still support only one column aggregate input.

Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the How To Contribute guide.
In addition to going through the list, please provide a meaningful description of your changes.

  • General

    • The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
    • The pull request addresses only one issue
    • Each commit in the PR has a meaningful commit message (including the JIRA id)
  • Documentation

    • Documentation has been added for new functionality
    • Old documentation affected by the pull request has been updated
    • JavaDoc for public methods has been added
  • Tests & Build

    • Functionality added by the pull request is covered by tests
    • mvn clean verify has been executed successfully locally or a Travis build has passed

@@ -857,28 +857,30 @@ object AggregateUtil {
aggregateCalls: Seq[AggregateCall],
inputType: RelDataType,
needRetraction: Boolean)
: (Array[Int], Array[TableAggregateFunction[_ <: Any]]) = {
: (Array[util.List[Integer]], Array[TableAggregateFunction[_ <: Any]]) = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an Array[Int] instead of a List[Integer]?

Scala Int is compiled to Java int primitive. java.lang.Integer is a boxed type.
Also an array access is faster than a List.get() access (ArrayList.get() would be a bit better).

@fhueske
Copy link
Contributor

fhueske commented Mar 30, 2017

The change looks good in general. I'd prefer to use an array instead of a List though.
What do you think @shaoxuan-wang?

@shaoxuan-wang
Copy link
Contributor Author

Thanks @fhueske, I overlooked a list is not always an arraylist. I change it to scala array, but keep the type as integer, as this is type returned (and not easy to be casted to Int) from aggregateCall.getArgList. I updated PR and also rebased to the master (as I noticed there are a few over aggregates have been recently merged), so it will be easier for you to merge.

@fhueske
Copy link
Contributor

fhueske commented Mar 31, 2017

Thanks @shaoxuan-wang, I found a way to cast the Integer to Int. Will change that and merge the PR.

Thanks, Fabian

fhueske pushed a commit to fhueske/flink that referenced this pull request Mar 31, 2017
@asfgit asfgit closed this in 91c90c5 Mar 31, 2017
SangeetaGulia pushed a commit to SangeetaGulia/flink that referenced this pull request Apr 4, 2017
p16i pushed a commit to p16i/flink that referenced this pull request Apr 16, 2017
hequn8128 pushed a commit to hequn8128/flink that referenced this pull request Jun 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants