Skip to content

fix: quote column names in merge_insert join to preserve case sensiti…#6397

Open
YSBF wants to merge 1 commit intolance-format:mainfrom
YSBF:fix/merge-insert-case-sensitive-columns
Open

fix: quote column names in merge_insert join to preserve case sensiti…#6397
YSBF wants to merge 1 commit intolance-format:mainfrom
YSBF:fix/merge-insert-case-sensitive-columns

Conversation

@YSBF
Copy link
Copy Markdown
Contributor

@YSBF YSBF commented Apr 3, 2026

…vity

DataFusion's DataFrame::join() lowercases unquoted identifiers, which causes merge_insert to fail when column names contain uppercase letters (e.g. "Stock", "Date"). The join key "target_Stock" is lowercased to "target_stock" internally, but the schema retains "target_Stock", causing a schema mismatch error:

No field named target_stock. Did you mean '?table?.Stock'?

Fix: wrap join column names in double quotes so DataFusion treats them as quoted identifiers and preserves their original casing. This is consistent with how prefix_columns() already quotes column names when aliasing.

Affects both the FullCompatible and Subschema join paths in create_full_table_joined_stream(). The indexed path (create_indexed_joined_stream) is not affected because it uses Column::new_with_schema() which does direct schema lookup.

…vity

DataFusion's DataFrame::join() lowercases unquoted identifiers, which
causes merge_insert to fail when column names contain uppercase letters
(e.g. "Stock", "Date"). The join key "target_Stock" is lowercased to
"target_stock" internally, but the schema retains "target_Stock", causing
a schema mismatch error:

  No field named target_stock. Did you mean '?table?.Stock'?

Fix: wrap join column names in double quotes so DataFusion treats them as
quoted identifiers and preserves their original casing. This is consistent
with how prefix_columns() already quotes column names when aliasing.

Affects both the FullCompatible and Subschema join paths in
create_full_table_joined_stream(). The indexed path
(create_indexed_joined_stream) is not affected because it uses
Column::new_with_schema() which does direct schema lookup.
@github-actions github-actions bot added the bug Something isn't working label Apr 3, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@wjones127 wjones127 self-assigned this Apr 3, 2026
Copy link
Copy Markdown
Contributor

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @YSBF. I thought I had already fixed this in #5465.

Could you add a unit test that fails without this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants