Skip to content
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

Support custom field metadata in UDF #13458

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

Conversation

lewiszlw
Copy link
Member

Which issue does this PR close?

Closes #.

Rationale for this change

In our case, we need put type data in schema metadata for supporting logical type. But there is no good way for the column generated by UDF.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Nov 18, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @lewiszlw

@@ -216,6 +217,15 @@ impl ScalarUDF {
self.inner.is_nullable(args, schema)
}

/// Returns the field metadata for this function.
pub fn metadata(
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels similar in usecase to #13290 -- if we merged #13290 would that solve your usecase?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like not. This pr is for supporting custom metadata when converting scalar function expr to schema field during planing.

@@ -477,6 +487,15 @@ pub trait ScalarUDFImpl: Debug + Send + Sync {
true
}

/// Returns the field metadata for this function.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a more detailed explanation would be useful for someone adding a new UDF to know why this method exists and what use case it is trying to solve. Without looking at this PR it's pretty opaque.

@Omega359
Copy link
Contributor

I think a test would be in order that would showcase why the new metadata method exists and what problem it solves.

@alamb
Copy link
Contributor

alamb commented Nov 25, 2024

I think a test would be in order that would showcase why the new metadata method exists and what problem it solves.

I agree.

@alamb
Copy link
Contributor

alamb commented Nov 27, 2024

Marking as draft as I think this PR is no longer waiting on feedback. Please mark it as ready for review when it is ready for another look

@alamb alamb marked this pull request as draft November 27, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants