Skip to content

Adding support for all_key_match#19853

Merged
rschlussel merged 1 commit intoprestodb:masterfrom
jainavi17:all_key_match
Jun 22, 2023
Merged

Adding support for all_key_match#19853
rschlussel merged 1 commit intoprestodb:masterfrom
jainavi17:all_key_match

Conversation

@jainavi17
Copy link
Contributor

@jainavi17 jainavi17 commented Jun 9, 2023

Returns whether all keys of a map match the given predicate. Returns true if all the keys match the predicate (a special case is when the map is empty); false if one or more keys don’t match; NULL if the predicate function returns NULL for one or more keys and true for all other keys.
Test plan

Added unit tests.
Build successfully using the following terminal command

  • ./mvnw clean install -Dtest=TestAllKeysMatchFunction -fn -pl presto-main

== RELEASE NOTES ==

General Changes

  • Add support for ALL_KEYS_MATCH udf in Presto

    • Returns whether all keys of a map match the given predicate. Returns true if all the keys match the predicate (a special case is when the map is empty); false if one or more keys don’t match; NULL if the predicate function returns NULL for one or more keys and true for all other keys.
    • SELECT ALL_KEYS_MATCH(map(ARRAY['a', 'b', 'c'], ARRAY[1, 2, 3]), x -> length(x) = 1); -- true

@jainavi17 jainavi17 requested a review from a team as a code owner June 9, 2023 20:48
@jainavi17 jainavi17 requested a review from presto-oss June 9, 2023 20:48
@jainavi17 jainavi17 force-pushed the all_key_match branch 2 times, most recently from 80378fc to 5b29110 Compare June 9, 2023 21:08
@jainavi17
Copy link
Contributor Author

@feilong-liu If you could review the diff.

@feilong-liu
Copy link
Contributor

Nit, remove the "::" at the end of the release note description.

@wanglinsong
Copy link
Member

Please update release notes base on the guidelines: https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines#phrasing

for example

== RELEASE NOTES ==
General Changes

  • item 1 ...

@rschlussel
Copy link
Contributor

Also, the commit message should follow the guidelines in the blog linked here: https://github.com/prestodb/presto/wiki/Review-and-Commit-guidelines#commit-formatting-and-pull-requests. So, the commit message title should be "Add support for all_keys_match function" (rather than "Adding"). And then the body can have a brief description.

UDF to check if all the keys present in the map matches the given predicate
@rschlussel rschlussel merged commit 6e1f475 into prestodb:master Jun 22, 2023
@wanglinsong wanglinsong mentioned this pull request Jul 27, 2023
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants