-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add SQL functions ARRAY_DUPES and ARRAY_HAS_DUPES #16317
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,12 @@ Array Functions | |
|
|
||
| Remove duplicate values from the array ``x``. | ||
|
|
||
| .. function:: array_dupes(array(T)) -> array(bigint/varchar) | ||
|
|
||
| Returns a set of elements that occur more than once in ``array``. | ||
|
|
||
| ``T`` must be coercible to ``bigint`` or ``varchar``. | ||
|
|
||
|
||
| .. function:: array_except(x, y) -> array | ||
|
|
||
| Returns an array of elements in ``x`` but not in ``y``, without duplicates. | ||
|
|
@@ -58,6 +64,12 @@ Array Functions | |
| Returns a map: keys are the unique elements in the ``array``, values are how many times the key appears. | ||
| Ignores null elements. Empty array returns empty map. | ||
|
|
||
| .. function:: array_has_dupes(array(T)) -> boolean | ||
|
|
||
| Returns a boolean: whether ``array`` has any elements that occur more than once. | ||
|
|
||
|
||
| ``T`` must be coercible to ``bigint`` or ``varchar``. | ||
|
|
||
| .. function:: array_intersect(x, y) -> array | ||
|
|
||
| Returns an array of the elements in the intersection of ``x`` and ``y``, without duplicates. | ||
|
|
||
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.
'repeated only once' is confusing. Just say the result is a set of elements that occur more than once in the original array.