Fix wildcard columns not matching when combined with optional (?) - #1155
Merged
Conversation
ebhills
approved these changes
Sep 1, 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.
Fix wildcard columns not matching when combined with optional (
?)Problem
Any column selector combining a wildcard (
*) with the optional marker (?) matched nothing, silently — the columns were just missing from the output, with no error.Root cause
wildcard_expansion()converts*patterns into escaped regex before checking for the trailing?optional marker. SoCol*?got turned into the regexCol(.*)\?, which requires the column name to literally end in a question mark character — never true for a real column — instead of being recognized as "wildcardCol*, marked optional."Fix
?marker before the*→regex conversion, and track optionality per-entry so a wildcard that matches zero columns is treated like a missing optional column (no error) instead of guaranteed to match nothing.wildcard_expansion()gets called twice on the samecolumnslist within a single write step (once generically inrecipe.py, again inside thefileconnector). The original code's optional-handling used a local variable and never mutated the caller's list, so this double-call was always safe. My first attempt at fix Allow setting credentials with environment variables #1 mutated the list in place to strip?, which broke the second call — it saw the marker already gone and raised anyway.Fixed by having the function operate on an internal copy — it no longer mutates the caller's list under any circumstance, regardless of how many times it's called with the same input.
Tests
Added to
tests/connectors/test_file.py:test_write_file_optional_wildcard_col_matches—Fi*?against a 2-column file correctly writes only the matching column.test_write_file_optional_wildcard_col_no_matches—NoSuchColumn*?alongside a real column writes only the real column, no error.Both read back the actual written file rather than trusting
recipe.run()'s return value, since write-step column filtering is a side effect on the output file, not on the pipeline dataframe.