Skip to content

Move concat, concat_ws, ends_with, initcap to datafusion-functions #10089

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

Omega359
Copy link
Contributor

Which issue does this PR close?

Closes #9540

Rationale for this change

Builtin scalar function migration

What changes are included in this PR?

Code, tests.

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates optimizer Optimizer rules core Core DataFusion crate labels Apr 15, 2024
@Omega359
Copy link
Contributor Author

Note that this PR isn't the final PR for removing the BuiltinScalarFunction - one last function (coalesce) remains which I'll create a ticket to migrate to the new crate shortly.

@Omega359 Omega359 marked this pull request as ready for review April 15, 2024 16:51
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 @Omega359 -- I think this PR looks good. Thank you for pushing this over the line 🙏

@@ -843,18 +802,9 @@ impl WindowUDFImpl for SimpleWindowUDF {
}
}

/// Calls a named built in function
pub fn call_fn(name: impl AsRef<str>, args: Vec<Expr>) -> Result<Expr> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting API change -- I wonder if this API is used to call functions by name in the expr API 🤔

However, it is currently going to be missing all the built in functions now that we port them to UDFs so a compiler error is probably better than a runtime error,

Maybe we can add such a function back eventually (using the API @jayzhan211 and @viirya were talking about in #9892 🤔 )

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 it's a useful function but from what I recall the compiler was complaining about it being unused currently. Of course, that doesn't mean it's not useful externally (it obviously is) but I think that re-implementing it in #9892 would be the best approach to take. I could add it back in during #10090 but I think it may have to live somewhere else unless a session context or something similar is passed in though

Copy link
Contributor

Choose a reason for hiding this comment

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

it may have to live somewhere else unless a session context or something similar is passed in though

Yes I agree with this. Now that there is no static global list of functions some sort of state needs to get passed in

@alamb alamb merged commit 8730466 into apache:main Apr 16, 2024
25 checks passed
Michael-J-Ward added a commit to Michael-J-Ward/datafusion-python that referenced this pull request May 13, 2024
andygrove pushed a commit to apache/datafusion-python that referenced this pull request May 14, 2024
* chore: upgrade datafusion Deps

Ref #690

* update concat and concat_ws to use datafusion_functions

Moved in apache/datafusion#10089

* feat: upgrade functions.rs

Upstream is continuing it's migration to UDFs.

Ref apache/datafusion#10098
Ref apache/datafusion#10372

* fix ScalarUDF import

* feat: remove deprecated suppors_filter_pushdown and impl supports_filters_pushdown

Deprecated function removed in apache/datafusion#9923

* use `unnest_columns_with_options` instead of deprecated `unnest_column_with_option`

* remove ScalarFunction wrappers

These relied on upstream BuiltinScalarFunction, which are now removed.

Ref apache/datafusion#10098

* update dataframe `test_describe`

`null_count` was fixed upstream.

Ref apache/datafusion#10260

* remove PyDFField and related methods

DFField was removed upstream.

Ref: apache/datafusion#9595

* bump `datafusion-python` package version to 38.0.0

* re-implement `PyExpr::column_name`

The previous implementation relied on `DFField` which was removed upstream.

Ref: apache/datafusion#9595
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates sql SQL Planner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move take concat, concat_ws, ends_with, initcap, to datafusion-functions
2 participants