-
Notifications
You must be signed in to change notification settings - Fork 180
Support mvdedup eval function
#4828
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
Conversation
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
core/src/main/java/org/opensearch/sql/expression/function/CollectionUDF/MVDedupCore.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/opensearch/sql/expression/function/CollectionUDF/MVDedupFunctionImpl.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/opensearch/sql/expression/function/CollectionUDF/MVDedupFunctionImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/expression/function/CollectionUDF/MVDedupCore.java
Outdated
Show resolved
Hide resolved
dai-chen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check if this has same semantic as ARRAY_DISTINCT?
2: jdbc:calcite:model=src/test/resources/mode> SELECT ARRAY_DISTINCT(ARRAY[1,2,1,3,3,4]);
+--------------+
| EXPR$0 |
+--------------+
| [1, 2, 3, 4] |
+--------------+
1 row selected (0.018 seconds)
2: jdbc:calcite:model=src/test/resources/mode> SELECT ARRAY_DISTINCT(ARRAY[4,1,2,1,3,3,4]);
+--------------+
| EXPR$0 |
+--------------+
| [4, 1, 2, 3] |
+--------------+
Signed-off-by: Kai Huang <[email protected]>
Hi @dai-chen, thanks for the suggestion! After checking, I think cc @ykmr1224 |
dai-chen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
|
Do we need to backport? |
Yes |
* Support eval function Signed-off-by: Kai Huang <[email protected]> * Updates Signed-off-by: Kai Huang <[email protected]> * update javadoc Signed-off-by: Kai Huang <[email protected]> * Update to use ARRAY_DISTINCT Signed-off-by: Kai Huang <[email protected]> --------- Signed-off-by: Kai Huang <[email protected]> (cherry picked from commit 5049a03) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support eval function * Updates * update javadoc * Update to use ARRAY_DISTINCT --------- (cherry picked from commit 5049a03) Signed-off-by: Kai Huang <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Support eval function Signed-off-by: Kai Huang <[email protected]> * Updates Signed-off-by: Kai Huang <[email protected]> * update javadoc Signed-off-by: Kai Huang <[email protected]> * Update to use ARRAY_DISTINCT Signed-off-by: Kai Huang <[email protected]> --------- Signed-off-by: Kai Huang <[email protected]>
Description
This PR implements the
mvdedupeval function for PPL, enabling users to remove duplicate values from multivalue arrays.Behavior
Given the input:
The function returns:
Key Details
Empty arrays return empty arrays
Order-preserving: The first appearance of each value is kept; subsequent duplicates are removed.
Example
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.