Skip to content

Conversation

@yybmion
Copy link

@yybmion yybmion commented Dec 5, 2025

Implements array_reverse() and array_sort() HQL functions.

  • array_reverse(array) - Returns reversed array
  • array_sort(array [, descending [, nulls_first]]) - Returns sorted array
    • Default: ASC, NULLs last
    • Follows PostgreSQL 18 semantics

All database tests pass.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19826

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Dec 5, 2025

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

Copy link
Member

@beikov beikov left a comment

Choose a reason for hiding this comment

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

This looks quite good already. I left a couple of comments.

@yybmion
Copy link
Author

yybmion commented Dec 9, 2025

Thanks for the guidance @beikov.
I've addressed all the review comments.

Copy link
Member

@beikov beikov left a comment

Choose a reason for hiding this comment

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

Can you also please do the simplifications I proposed across all three emulations?

@yybmion
Copy link
Author

yybmion commented Dec 11, 2025

Thanks for the detailed review @beikov.

Changed as requested in 0813a4c

Implement array_reverse() and array_sort() with PostgreSQL 18 semantics.
Supports PostgreSQL, H2, HSQLDB, Oracle, and CockroachDB with native functions or SQL emulation as appropriate.

Signed-off-by: Yoobin Yoon <yunyubin54@gmail.com>
@yybmion
Copy link
Author

yybmion commented Dec 11, 2025

@beikov Additionally updated array_sort emulations(PostgreSQLArraySortEmulation,HSQLArraySortFunction) to use array[] fallback with case when wrapper for consistency.

@beikov
Copy link
Member

beikov commented Dec 12, 2025

Great job, thanks!

@beikov
Copy link
Member

beikov commented Dec 12, 2025

FYI, we will be merging this PR next week when we branch off for 7.2 and main becomes 7.3

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.

2 participants