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

Fix sorting with multiple SortByClauses #15

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

51-code
Copy link
Contributor

@51-code 51-code commented Jun 7, 2024

Related to PTH-10 issue #256.

The SortOperation takes a List of SortByClauses as parameter to sort with. However, the List was used in a for loop in a way that it always overrode the previous sorting that had happened, ultimately only applying sorting to the dataset with the last SortByClause of the List. Not likely that this was intentional.

I changed it so that it now executes just one orderBy() call for all of the SortByClauses.

So it now sorts first with the column that is first on the list, then inside that sorting it sorts again with the second column and so on. This means it preserves the sorting of the column that was in the list before.

@51-code 51-code added bug Something isn't working feature Existing feature labels Jun 7, 2024
@51-code 51-code self-assigned this Jun 7, 2024
Copy link
Contributor

@eemhu eemhu left a comment

Choose a reason for hiding this comment

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

Looks good to me, it could use additional tests for different datatypes though

@51-code 51-code requested a review from eemhu June 7, 2024 06:09
@51-code
Copy link
Contributor Author

51-code commented Jun 7, 2024

Looks good to me, it could use additional tests for different datatypes though

Added more tests and all datatypes are now utilized, including the AUTOMATIC type in SortByClause.

Forgot to mention earlier, all tests in PTH-10 are passing when using this branch locally! There is just a small need for fixes in PTH-10 because I refactored BatchCollect and SortByClause to not accept null anymore and there was a few calls that passed null to constructors in PTH-10. Otherwise all good.

Copy link
Contributor

@StrongestNumber9 StrongestNumber9 left a comment

Choose a reason for hiding this comment

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

Tests should not throw anything

src/test/java/SortOperationTest.java Outdated Show resolved Hide resolved
src/test/java/SortOperationTest.java Outdated Show resolved Hide resolved
src/test/java/SortOperationTest.java Outdated Show resolved Hide resolved
src/test/java/SortOperationTest.java Outdated Show resolved Hide resolved
Copy link
Contributor

@StrongestNumber9 StrongestNumber9 left a comment

Choose a reason for hiding this comment

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

Change the ip address ranges

src/test/java/SortOperationTest.java Outdated Show resolved Hide resolved
Copy link
Contributor

@StrongestNumber9 StrongestNumber9 left a comment

Choose a reason for hiding this comment

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

Seems ok

Copy link
Member

@kortemik kortemik left a comment

Choose a reason for hiding this comment

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

lgtm

@kortemik kortemik merged commit d0e2257 into teragrep:main Jun 13, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature Existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants