Conversation
The node handed to @parameterize always wrapped the function in the column-renaming wrapper, so reassign_columns=False had no effect: the output columns were still renamed by position, and an extracted column could silently carry another column's data. Build the node from the function chosen by reassign_columns. Generated-by: Claude Code (Claude Opus 5.5)
skrawcz
force-pushed
the
fix/parameterize-extract-columns-reassign-false
branch
from
September 26, 2026 18:52
ce2bbb1 to
d0442a0
Compare
skrawcz
approved these changes
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@parameterize_extract_columns(..., reassign_columns=False)ignores the flag.expand_nodebuilds the node it passes to@parameterizewithcallabl=wrapper_fnevery time, andparameterize.expand_nodecallsnode_.callable. So thefn_to_callchoice never takes effect: the output columns are still renamed by position. Each extracted column can then silently carry another column's data.If the function returns a different number of columns than
outputs, the rename also raises a length-mismatch error, which is the other casereassign_columns=Falseis meant to allow.Changes
hamilton/function_modifiers/expanders.py: build the node fromfn_to_call(the renaming wrapper only whenreassign_columns=True), so the flag takes effect. The defaultTruepath is unchanged.tests/function_modifiers/test_expanders.py:test_parameterized_extract_columns_no_reassign_columns.How I tested this
main(661aa888): fails withDataFrame.columns are different ... [left]: ['y', 'x'] [right]: ['x', 'y'].test_parameterized_extract_columns(the default path) still passes.pytest tests/function_modifiers tests/test_function_modifiers.py tests/test_end_to_end.py tests/test_hamilton_driver.py tests/test_async_driver.py: 528 passed.ruff checkandruff format --check(0.15.14) are clean.git diff --checkis clean.Notes
The flag has had no effect since
parameterize_extract_columnswas added in 72b0a09 (2022-11).Checklist
AI disclosure (per the ASF Generative Tooling guidance): this change was written with an AI coding tool (Claude Code, Claude Opus 5.5) working through the
breken-aiaccount. The tool found the bug, wrote the fix and the test, and wrote this description. The commit carries aGenerated-by:trailer. The diff is a small original change to existing Hamilton code and includes no third-party material. The red/green runs above are real and can be re-run from the diff. If you would rather not take AI-assisted contributions here, say so and I will close this.