You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding of the high level assumptions are:
schema level metadata: always passed through
field level metadata: when there is a clear 1-1 correspondence from an input column with metadata to an output column, the metadata should be preserved
Examples
PROJECT(a, b+c) --> field metadata ona should be preserved, no field metadata on b+c
SUM(a) .. GROUP BY b --> field metadata on b is preserved, not on a
I'm not sure if this is related or not but I encountered an error during optimization:
Error: join_selection caused by Internal error: PhysicalOptimizer rule 'join_selection' failed, due to generate a different schema, original schema: Schema { fields: [Field { name: "a", ... }], metadata: {metadata_from_table_one}, new schema: Schema { fields: [Field { name: "a", ... }], metadata: {metadata_from_table_two}. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
I think the join operator is either returning the metadata from the first or second input and so an optimization that swaps the join order results in the output schema of the join operator changing and this causes the optimizer to bail.
@alamb -- I'm taking a look back at this ticket. There has been some changes, and I'm unclear as to long term plans.
There is a new FieldMetadata which only applies to literals and unifies it's handling? What about non-literal fields?
How (or is) this related to a consolidation of how schema field metadata is handled? Are we unifying a single wrapper abstraction to handle how merging (e.g. union), precedence (e.g. joins?), aggregates, lists, and/or casting is handled?
@alamb -- I'm taking a look back at this ticket. There has been some changes, and I'm unclear as to long term plans.
There is a new FieldMetadata which only applies to literals and unifies it's handling? What about non-literal fields?
How (or is) this related to a consolidation of how schema field metadata is handled? Are we unifying a single wrapper abstraction to handle how merging (e.g. union), precedence (e.g. joins?), aggregates, lists, and/or casting is handled?
TLDR is I don't know of any unified plan.
What I would recommend doing is starting by documenting what (little) is known today (about projections and aliases)
Then as we evolve and the plans become clearer, we will at least have a place to improve the documenetion
I think starting with something even if it is incomplete, is better than the status quo (nothing)
Activity
alamb commentedon Oct 3, 2024
I believe @wiedld plans to work on this
wiedld commentedon Oct 3, 2024
take
alamb commentedon Oct 21, 2024
I will take a shot at documenting this
alamb commentedon Nov 13, 2024
#13305 (comment) has some additional context
westonpace commentedon Jan 24, 2025
I'm not sure if this is related or not but I encountered an error during optimization:
I think the join operator is either returning the metadata from the first or second input and so an optimization that swaps the join order results in the output schema of the join operator changing and this causes the optimizer to bail.
alamb commentedon Jan 24, 2025
That definitely sounds like a bug
wiedld commentedon Aug 18, 2025
@alamb -- I'm taking a look back at this ticket. There has been some changes, and I'm unclear as to long term plans.
There is a new FieldMetadata which only applies to literals and unifies it's handling? What about non-literal fields?
How (or is) this related to a consolidation of how schema field metadata is handled? Are we unifying a single wrapper abstraction to handle how merging (e.g. union), precedence (e.g. joins?), aggregates, lists, and/or casting is handled?
alamb commentedon Aug 18, 2025
TLDR is I don't know of any unified plan.
What I would recommend doing is starting by documenting what (little) is known today (about projections and aliases)
Then as we evolve and the plans become clearer, we will at least have a place to improve the documenetion
I think starting with something even if it is incomplete, is better than the status quo (nothing)
wiedld commentedon Aug 19, 2025
Non-exhaustive list, as I find things:
merging, in logical plans & their expressions: Document schema merging. #17249adriangb commentedon Dec 15, 2025
I found a bug with first_value / last_value: #19335