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

ScalarUDFImpl invoke improvements #13507

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

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Nov 20, 2024

Builds on #13290 from @joseph-isaacs

Which issue does this PR close?

Rationale for this change

If we are going to change the signature of invoke I would to make it possible in the future to reuse allocations -- at the moment the API requires creating new arrays even when the input array is not used because the functions get the input as &[ColumnarValues] meaning they don't own them (the caller retains a reference)

What changes are included in this PR?

Change ScalarFunctionArgs to pass by value

1,

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions functions labels Nov 20, 2024
// evaluate the function
let output = self.fun.invoke_batch(&inputs, batch.num_rows())?;
let output = self.fun.invoke_with_args(ScalarFunctionArgs {
args: inputs,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the whole point of this PR is to pass in inputs here rather than inputs.as_ref

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually we should probably consider doing the same thing for evaluate 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions logical-expr Logical plan and expressions physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perf: Allow User defined functions to potentially reuse their argument arrays (to avoid new allocations)
2 participants