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

diff: Fix name to index conversion #2457

Merged

Conversation

janriemer
Copy link

This fixes the conversion from column name -> index for diff options
--key and --sort-columns, which is part of #2443.

The issue was that enumeration idx and 1 had been added to the already
correct result (obtained via .position iterator method).
So now, only .position is used to get the correct idx of a column name.

Before this change, one test has tried to validate the logic of providing
column names instead of indices, but the test itself was wrong, as the
diff result that was validated did not have the correct sort order.
This test is now also fixed.

Additionally, this provides some more tests for error conditions
regarding name -> index conversion.

Jan Riemer added 2 commits January 19, 2025 22:41
This fixes the conversion from column name -> index for `diff` options
`--key` and `--sort-columns`, which is part of dathere#2443.

The issue was that `enumeration idx` and `1` had been added to the already
correct result (obtained via `.position` iterator method).
So now, only `.position` is used to get the correct idx of a column name.

Before this change, one test has tried to validate the logic of providing
column names instead of indices, but the test itself was wrong, as the
diff result that was validated did not have the correct sort order.
This test is now also fixed.

Additionally, this provides some more tests for error conditions
regarding name -> index conversion.
Logic was duplicated over four places, so we refactor it
into it's own trait extension on `String`.
@jqnatividad jqnatividad merged commit 4a8eb2b into dathere:master Jan 20, 2025
13 checks 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