hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-19826 Add array_reverse and array_sort functions

Open yybmion opened this issue 3 weeks ago • 2 comments

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

yybmion avatar Dec 05 '25 15:12 yybmion

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

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

yybmion avatar Dec 09 '25 15:12 yybmion

Thanks for the detailed review @beikov.

Changed as requested in https://github.com/hibernate/hibernate-orm/commit/0813a4caa4e382dd6078422d29f97bf368612f17

yybmion avatar Dec 11 '25 04:12 yybmion

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

yybmion avatar Dec 11 '25 14:12 yybmion

Great job, thanks!

beikov avatar Dec 12 '25 12:12 beikov

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

beikov avatar Dec 12 '25 13:12 beikov