Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Nov 28, 2023

Which issue does this PR close?

Related to #8258

Rationale for this change

While integrating the change from #8258 downstream in IOx, I found it would have been very helpful to have fun.name() available and I think it makes the code more consise

What changes are included in this PR?

Add expr::ScalarFunction::name()

Are these changes tested?

Existing tests

Are there any user-facing changes?

@github-actions github-actions bot added logical-expr Logical plan and expressions core Core DataFusion crate substrait Changes to the substrait crate labels Nov 28, 2023

impl ScalarFunction {
// return the Function's name
pub fn name(&self) -> &str {
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 point of the PR is to add this

}
Expr::ScalarFunction(ScalarFunction { func_def, args }) => {
fmt_function(f, func_def.name(), false, args, true)
Expr::ScalarFunction(fun) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing so I think makes code like this easier / less inceptionish (Expr::ScalarFunction vs expr::ScalarFunction 🤯 )

Copy link
Contributor

@universalmind303 universalmind303 left a comment

Choose a reason for hiding this comment

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

great small improvement. I was actually going to open up an issue to expose the name as a method. I'm currently working on an unrelated PR that is manually mapping the variants to the names, but this'll make it much easier & cleaner.

@alamb alamb merged commit bbec787 into apache:main Nov 29, 2023
@alamb
Copy link
Contributor Author

alamb commented Nov 29, 2023

Thanks @universalmind303

@alamb alamb deleted the alamb/add_scalar_function_name branch November 29, 2023 17:18
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 substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants