Skip to content

Support metadata on scalar values #16053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

timsaucer
Copy link
Contributor

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 the Expr::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

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates optimizer Optimizer rules core Core DataFusion crate labels May 14, 2025
@timsaucer
Copy link
Contributor Author

Leaving in draft for now because we also need to verify that the scalar output metadata is correctly maintained.

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label May 15, 2025
@timsaucer timsaucer force-pushed the feat/literal_metadata branch from 821bffd to dce4360 Compare May 15, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support metadata on literal values
1 participant