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: grade columns in deterministic ordering #6

Conversation

Samathingamajig
Copy link
Contributor

@Samathingamajig Samathingamajig commented Mar 23, 2024

As mentioned in #5, currently parsing the csv files results in non-deterministic ordering in grade columns.

By sorting the data across multiple runs of ut_grade_parser parse, it's clear that all the data is always there, however, the column order is randomized.

image

The random column ordering only seems to happen on the grade columns (A, A-, B+, B, B-, ..., D+, D, D-, F, Other)

The reason for this was that inserting the grade columns was just a loop over a HashMap, relying on it for the ordering. The problem with that is that HashMaps have arbitrary ordering. Switching to a BTreeSet wouldn't help here, since that sorts based on UTF-8 ordering, not insertion order.

fixes #5, unblocks Longhorn-Developers/UT-Registration-Plus#163

@Samathingamajig Samathingamajig marked this pull request as ready for review March 23, 2024 21:40
@Samathingamajig Samathingamajig marked this pull request as draft March 24, 2024 00:00
@Samathingamajig
Copy link
Contributor Author

oopsies: i realized that BTreeSet is sorting based on the keys, not the insertion order, so this PR needs to be redone

@Samathingamajig Samathingamajig marked this pull request as ready for review March 24, 2024 02:18
@doprz doprz self-requested a review March 24, 2024 02:57
@doprz doprz added the bug Something isn't working label Mar 24, 2024
Copy link
Owner

@doprz doprz left a comment

Choose a reason for hiding this comment

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

Approved! Thank you for your PR!

@doprz doprz merged commit 4074d20 into doprz:main Mar 24, 2024
6 checks passed
@Samathingamajig Samathingamajig deleted the sgunter/fix-grade-columns-deterministic-ordering branch March 24, 2024 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Parsing csv files results in non-deterministic ordering in grade columns
2 participants