Conversation
Signed-off-by: Anant <75747269+Anant-gif@users.noreply.github.com>
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.
Description
Fixes #6067
Change
Rather than making each individual dict lookup case insensitive, this change reconciles the
casing once, at the point where the key columns are parsed. A new
_resolve_column_namehelpermaps each normalized key back to the column name reported by the engine for its table:
KEYandkeykeep working
still fails loudly as before
The source and the target are resolved against their own schema, since they can disagree on casing. Both the list form of
onand the expression form are covered.Everything downstream then uses a single spelling that matches the engine, so no other call site needs to be aware of casing. This mirrors
SchemaDiff._original_column_name, (which is opt-in) which already maps lowercased column names back to the engine-reported spelling for the schema diff , the key column resolution is always on since a key that does not resolve makes the row diff impossible to run.Test Plan
Added three tests in
tests/core/test_table_diff.py, all of which fail onmainand pass with this change:test_data_diff_non_lowercase_key_columns: key columns stored asKEY1/Key2, supplied inboth matching and non matching casing, plus the single key column path which fails in a
different place from the multi key path
test_data_diff_key_columns_with_differing_case_between_source_and_target: source and targetstore the same key columns with different casing, so each side must be resolved against its own
schema
test_data_diff_non_lowercase_key_columns_in_on_condition: same scenario with anonexpression instead of a list, covering the second branch of
key_columnsAlso ran this against a live BigQuery project with mixed-case identifiers to confirm the CLI flags resolve without errors.
Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO