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-8013] [table] Support aggregate functions with generic arrays #5011

Closed
wants to merge 1 commit into from

Conversation

twalthr
Copy link
Contributor

@twalthr twalthr commented Nov 14, 2017

What is the purpose of the change

Adds supports for aggregate functions with generic arrays and fixes other bugs.

Brief change log

  • Changes to the type extraction at several locations.

Verifying this change

Complex aggregation function added.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

import org.apache.flink.table.api.Types

/**
* User-defined aggregation function to compute the TOP 10 most visited pages.
Copy link
Contributor

@fhueske fhueske Nov 15, 2017

Choose a reason for hiding this comment

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

Adjust the comment:

User-defined aggregation function to compute the top 10 Int IDs with the highest Float values.
We use an Array[Tuple2[Int, Float]] as accumulator to store the top 10 entries.

@@ -55,7 +55,6 @@ object CollectionDataSets {
data.+=((19, 6L, "Comment#13"))
data.+=((20, 6L, "Comment#14"))
data.+=((21, 6L, "Comment#15"))
Random.shuffle(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be added back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the result of this shuffle is discarded. data is not modified.

@@ -0,0 +1,107 @@
package org.apache.flink.table.utils
Copy link
Contributor

Choose a reason for hiding this comment

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

ASF header missing :-)

Copy link
Contributor

@fhueske fhueske left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @twalthr.
The fix looks good. I left a few comments that should be addressed before merging the PR.

Thanks, Fabian

@twalthr
Copy link
Contributor Author

twalthr commented Nov 15, 2017

Merging this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants