Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Apr 15, 2024

Which issue does this PR close?

Closes tinfoil-knight#1
Closes #10003

Follow on to #9983

Rationale for this change

in #9983 @tinfoil-knight ported over exp/power to be ScalarUDFs 🙏 -- while reviewing the PR I noticed that we could reduce some clones and worked up the code in tinfoil-knight#1

What changes are included in this PR?

  1. Avoid cloning in log::simplify and power::simplify

Are these changes tested?

Are there any user-facing changes?

@alamb alamb marked this pull request as ready for review April 16, 2024 11:20
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

💪 thanks @alamb

// log(base, number)
let num_args = args.len();
if args.len() > 2 {
return plan_err!("Expected log to have 1 or 2 arguments, got {num_args}");
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be an exec error to match similar patterns elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

lets fix it in follow up. tbh we should unify error messaging for all builtin functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the idea here is that simplify gets called as part of planning (not execution) so planning makes sense to me. Though I am not sure what practical difference it makes in this case 🤔

@alamb alamb merged commit 0f88a2d into apache:main Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid cloning when simplifying expressions for Log, Power UDF

3 participants