-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Adding support of MAP_TOP_N_KEYS to Presto #18625
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a59a004
to
ae9c23c
Compare
kaikalur
requested changes
Nov 7, 2022
presto-main/src/test/java/com/facebook/presto/operator/scalar/sql/TestMapTopNKeysFunction.java
Outdated
Show resolved
Hide resolved
75eb008
to
561453d
Compare
kaikalur
requested changes
Nov 7, 2022
presto-main/src/main/java/com/facebook/presto/operator/scalar/sql/MapSqlFunctions.java
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/operator/scalar/sql/TestMapTopNKeysFunction.java
Show resolved
Hide resolved
kaikalur
requested changes
Nov 7, 2022
presto-main/src/test/java/com/facebook/presto/operator/scalar/sql/TestMapTopNKeysFunction.java
Show resolved
Hide resolved
kaikalur
approved these changes
Nov 7, 2022
5dcb700
to
f98ea45
Compare
highker
approved these changes
Nov 7, 2022
...ain/src/test/java/com/facebook/presto/operator/scalar/TestMapTopNKeysComparatorFunction.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/operator/scalar/sql/TestMapTopNKeysFunction.java
Outdated
Show resolved
Hide resolved
presto-main/src/test/java/com/facebook/presto/operator/scalar/sql/TestMapTopNKeysFunction.java
Outdated
Show resolved
Hide resolved
9be8e7c
to
aa79437
Compare
kaikalur
requested changes
Nov 7, 2022
presto-main/src/main/java/com/facebook/presto/operator/scalar/sql/MapSqlFunctions.java
Outdated
Show resolved
Hide resolved
ee35c02
to
48de7c1
Compare
kaikalur
approved these changes
Nov 7, 2022
presto-main/src/main/java/com/facebook/presto/operator/scalar/sql/MapSqlFunctions.java
Outdated
Show resolved
Hide resolved
d12cf4e
to
eb26bb8
Compare
Can we merge this? |
30 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add an UDF for getting top N keys of a map, which returns an array of the top N keys of map. Optionally a lambda comparator can also be passed to perform a custom comparison of the values. Returns all the value if the value N is greater than or equal to size of the map. N must be >= 0. For N = 0, the function returns empty array.
map_top_n_keys(map(K, V), N) -> array(K)
map_top_n_keys(map(K, V), N, function(K, K, int)) -> array(K)
Return the top N keys of the map sorted using the lambda comparator.
Test plan - (Please fill in how you tested your changes)
Added unit tests.
Build successfully using the following terminal command
./mvnw clean install -Dtest=TestMapTopNKeysFunction -fn -pl presto-main
./mvnw clean install -Dtest=TestMapTopNKeysComparatorFunction -fn -pl presto-main
Fill in the release notes towards the bottom of the PR description.
See Release Notes Guidelines for details.