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

Adding support for ARRAY_SORT_DESC to Presto #18660

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

jainavi17
Copy link
Contributor

@jainavi17 jainavi17 commented Nov 10, 2022

Adding an UDF for sorting array elements in the descending order. The elements of array must be orderable. Null elements will be placed at the end of the returned array.

array_sort_desc(array(T)) -> array(T)

Test plan
Added unit tests.
Build successfully using the following terminal command

  • mvn -Dtest=TestArraySqlFunctions install
== RELEASE NOTES ==

General Changes
* Add :func:`array_sort_desc` function to sort an array in the descending order

@jainavi17 jainavi17 requested a review from a team as a code owner November 10, 2022 16:02
@jainavi17 jainavi17 requested a review from presto-oss November 10, 2022 16:02
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 10, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: jainavi17 / name: Avinash Jain (30aa812751da1ee0ffc593e341351fd996076f98)

@jainavi17 jainavi17 force-pushed the array_sort_desc branch 3 times, most recently from 7e4df46 to 30aa812 Compare November 10, 2022 16:24
@kaikalur
Copy link
Contributor

Adding an UDF for sorting array elements in the descending order. The elements of array must be orderable. Null elements will be placed at the end of the returned array.

array_sort_desc(array(T)) -> array(T)

Test plan Added unit tests. Build successfully using the following terminal command

  • mvn -Dtest=TestArraySqlFunctions install
== RELEASE NOTES ==

General Changes
* Adding support for ARRAY_SORT_DESC
* Returns an array sorted in the descending order. The elements should be orderable else function will throw an error. Similar to ARRAY_SORT, null elements are placed at the end of the array.

.. function:: array_sort_desc(array(T)) -> array(T)
   Returns sorted ``array`` in descending order

`SELECT array_sort_desc(ARRAY [100, 1, 10, 50]); -- [100, 50, 10, 1]`
`SELECT array_sort_desc(ARRAY [null, 100, null, 1, 10, 50]); -- [100, 50, 10, 1, null, null]`
`SELECT array_sort_desc(ARRAY [null, 100, null, 1, 10, 50]); -- [100, 50, 10, 1, null, null]`

Formatting release notes

Copy link
Contributor

@highker highker left a comment

Choose a reason for hiding this comment

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

The release note is too verbose. We only need one (long) line to explain what it does in English. Also, we need :func: annotation for the function name so it can be linked to the doc you wrote.

@v-jizhang
Copy link
Contributor

@bot kick off tests

@jainavi17
Copy link
Contributor Author

The release note is too verbose. We only need one (long) line to explain what it does in English. Also, we need :func: annotation for the function name so it can be linked to the doc you wrote.

Done!

@jainavi17
Copy link
Contributor Author

Can we merge this PR?

@kaikalur kaikalur merged commit 19a9bb8 into prestodb:master Nov 11, 2022
@wanglinsong wanglinsong mentioned this pull request Jan 12, 2023
30 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