Support metadata on scalar values #16053
Draft
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.
Which issue does this PR close?
Rationale for this change
Now that we have metadata processing on scalar UDFs, we need to support scalar values that have metadata associated with them. This will allow users to send scalar values to these functions and also evaluate the metadata. This also impacts how extension types would be handled by these UDFs.
What changes are included in this PR?
This PR adds in the option to pass metadata from an alias expression on a literal value through to the physical plan. It requires some rework of the expression simplifier code where we now check aliases to see if they have metadata instead of just simplifying all aliases.
It is unclear to me if instead of relying on
Alias
to add metadata if we need to add this directly into theExpr::Literal
struct instead. That would be a more impactful change to downstream projects, but I am willing to add that work if people believe it would make for a better implementation.Are these changes tested?
Unit test added, and will also be testing with geoarrow-rs project where an example of this problem was discovered.
Are there any user-facing changes?
None