Skip to content

Respect zero-based indices when selecting csvjoin keys - #1398

Open
FFspiky wants to merge 1 commit into
wireservice:masterfrom
FFspiky:fix/csvjoin-zero-based-keys
Open

FFspiky wants to merge 1 commit into
wireservice:masterfrom
FFspiky:fix/csvjoin-zero-based-keys

Conversation

@FFspiky

@FFspiky FFspiky commented Nov 24, 2026

Copy link
Copy Markdown

Fixes #1397.

csvjoin --zero -c 0 rejected the first column. A positive index silently selected the preceding column, so a join could discard matching rows. Pass the offset from get_column_offset() to the existing identifier resolver for each input. The default one-based mode and named columns keep their behavior.

The tests cover the first and subsequent columns, different key positions across three files, outer joins, out-of-range diagnostics, and the default and named modes. Joining the bundled Iris records to their species metadata with zero-based keys 4,1 returned zero rows on master. With this change the header and all 150 rows match an independent dictionary join.

On macOS arm64 with Python 3.13.2, the full suite passed (373 passed, four skipped, plus 34 passing subtests). The wheel and source distribution also passed twine check. OpenAI Codex prepared and tested this contribution.

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.

csvjoin ignores --zero for numeric join columns

1 participant