Uh oh!
There was an error while loading. Please reload this page.
Document schema merging. - #17249
Conversation
| /// - For qualified fields: both qualifier and field name must match | ||
| /// - For unqualified fields: only field name needs to match | ||
| /// | ||
| /// Note: the merging operation prefers the first `self` fields, and the second `other_schema` metadata. |
There was a problem hiding this comment.
Note that this definition of schema merging behaves a differently in precedence for fields (prefer self), vs metadata (prefer other).
| /// Merges two optional `FieldMetadata` instances, overwriting any existing | ||
| /// keys in `m` with keys from `n` if present | ||
| /// keys in `m` with keys from `n` if present. | ||
| /// | ||
| /// This function is commonly used in alias operations, particularly for literals | ||
| /// with metadata. When creating an alias expression, the metadata from the original | ||
| /// expression (such as a literal) is combined with any metadata specified on the alias. |
There was a problem hiding this comment.
This structure is intended for use with the aliasing of literals.
Since it has the same concept of field metadata merge, I felt it was useful to add these docs in the same PR.
| /// | ||
| /// This function merges schemas from multiple logical plan inputs using [`DFSchema::merge`]. | ||
| /// Refer to that documentation for details on precedence and metadata handling. | ||
| pub fn merge_schema(inputs: &[&LogicalPlan]) -> DFSchema { |
There was a problem hiding this comment.
This prefers us to the other docs:
https://github.com/apache/datafusion/pull/17249/files#r2286497514
Jefffrey
left a comment
There was a problem hiding this comment.
Some minor wording suggestions but overall looks good
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
alamb
commented
Aug 21, 2025
I a running some benchmarks on this PR as a way to test my benchmark running script -- I don't expect that this PR changes the speed at all |
alamb
commented
Aug 21, 2025
🤖 |
alamb
commented
Aug 21, 2025
🤖: Benchmark completed Details |
This comment was marked as outdated.
This comment was marked as outdated.
alamb
commented
Aug 21, 2025
🤖 |
alamb
commented
Aug 21, 2025
🤖: Benchmark completed Details |
alamb
commented
Aug 21, 2025
🤖 |
alamb
commented
Aug 21, 2025
🤖 |
alamb
commented
Aug 21, 2025
🤖: Benchmark completed Details |
Uh oh!
There was an error while loading. Please reload this page.
Which issue does this PR close?
Part of #12736.
Rationale for this change
Docs for how schema gets merge.
Note that we have 2 different definitions of schema "merging".
What changes are included in this PR?
Docs.
Are these changes tested?
N/A
Are there any user-facing changes?
Only docs.