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

Match Union's sort order with enum's and with sort order in 4.x #830

Merged
merged 1 commit into from
May 25, 2024

Conversation

vkorchik
Copy link
Contributor

Seems like annotation @AvroSortPriority sorts records in Union in reversed order comparing with Enums, as well as with Enums/Unions from avro4s:4.x.

Probably the reason is a sort order here in Subtypes. Comparing with enums in 5.x and unions in 4.x, it seems to me that the Ordering compares A with B - ascending order, when instead it should compare B to A - descending.
Since AvroSortPriority is descending-based (if we could say so), then there should be B compare A.

The same (but reversed) issue with AvroUnionPosition will be automatically resolved since these two annotations are tightly coupled anyway.

@vkorchik vkorchik changed the title Match sort order with enums and with sort order in 4.x Match Union's sort order with enums and with sort order in 4.x Apr 19, 2024
@vkorchik vkorchik force-pushed the feature/union-sort-order-fix branch from 4897104 to 2f1b2fc Compare April 19, 2024 23:43
@vkorchik vkorchik changed the title Match Union's sort order with enums and with sort order in 4.x Match Union's sort order with enum's and with sort order in 4.x Apr 21, 2024
@vkorchik
Copy link
Contributor Author

vkorchik commented May 7, 2024

@sksamuel , could you please review this PR?

@sksamuel sksamuel merged commit 0370be4 into sksamuel:master May 25, 2024
1 check passed
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