Skip to content

fix: Improve error message for metadata conflict in schema - #23952

Merged
2010YOUY01 merged 3 commits into
apache:mainfrom
mkleen:improve-err-schema-mismatch
Aug 1, 2026
Merged

fix: Improve error message for metadata conflict in schema#23952
2010YOUY01 merged 3 commits into
apache:mainfrom
mkleen:improve-err-schema-mismatch

Conversation

@mkleen

@mkleen mkleen commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Based on the discussion with @2010YOUY01 in #23461 this pr improves the error message when there is a metadata conflict when schemas get merged. It also reverts #23605, so CrossJoinExec has again the original behavior.

select * from larger_table cross join smaller_table;

DataFusion error: PhysicalOptimizer rule 'join_selection' failed. Schema mismatch caused by 
Internal error: Schema metadata mismatch: Expected original metadata: {"metadata_key": "right"}, got metadata: {"metadata_key": "left"}

What changes are included in this PR?

Are these changes tested?

Yes

Are there any user-facing changes?

Yes, error message improved when the schema metadata has conflicting keys using a cross-join.

@github-actions github-actions Bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) physical-plan Changes to the physical-plan crate labels Jul 28, 2026
@mkleen mkleen changed the title Improve error message for metadata conflict in schema fix: Improve error message for metadata conflict in schema Jul 28, 2026
@mkleen
mkleen force-pushed the improve-err-schema-mismatch branch 3 times, most recently from b541f02 to 0cf026b Compare July 29, 2026 10:20
@mkleen
mkleen force-pushed the improve-err-schema-mismatch branch from 0cf026b to 745aed7 Compare July 29, 2026 10:49
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.75%. Comparing base (68d5874) to head (a96c221).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/core/src/physical_planner.rs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #23952    +/-   ##
========================================
  Coverage   80.75%   80.75%            
========================================
  Files        1096     1096            
  Lines      373282   373522   +240     
  Branches   373282   373522   +240     
========================================
+ Hits       301440   301642   +202     
- Misses      53869    53894    +25     
- Partials    17973    17986    +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mkleen
mkleen marked this pull request as ready for review July 29, 2026 16:44
@mkleen

mkleen commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@2010YOUY01 Could you do a review please?

@2010YOUY01 2010YOUY01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thank you!

@mkleen

mkleen commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

LGTM, thank you!

Thanks for the review!

@2010YOUY01
2010YOUY01 added this pull request to the merge queue Aug 1, 2026
Merged via the queue into apache:main with commit b4cde12 Aug 1, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-plan Changes to the physical-plan crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Join swap in join_selection flips schema-level metadata, failing "Schema mismatch"

3 participants