1064/enhancement/add functions to Expr class by deanm0000 · Pull Request #1074 · apache/datafusion-python · GitHub
Skip to content

1064/enhancement/add functions to Expr class#1074

Merged
timsaucer merged 1 commit into
apache:mainfrom
deanm0000:funcs_to_exprs
Apr 27, 2025
Merged

1064/enhancement/add functions to Expr class#1074
timsaucer merged 1 commit into
apache:mainfrom
deanm0000:funcs_to_exprs

Conversation

@deanm0000

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Works towards closing #1064

Rationale for this change

To improve ergonomics of the API by adding functions to the Expr class so that they can be chained

What changes are included in this PR?

This includes function definitions in the Expr class for all the single argument functions that take Expr and return Expr

Are there any user-facing changes?

Yes, users can use functions chained from other Exprs for example col("a").abs().tan()

No breaking changes.

@deanm0000

Copy link
Copy Markdown
Contributor Author

@timsaucer

Copy link
Copy Markdown
Member

I do love this PR. I hadn't looked at it since it's in draft, but I fully endorse.

@timsaucer

Copy link
Copy Markdown
Member

Let me know when it's ready for review

@deanm0000

Copy link
Copy Markdown
Contributor Author

I'll mark it ready and just do a second PR for more methods.

@deanm0000 deanm0000 marked this pull request as ready for review March 22, 2025 16:43
@deanm0000

Copy link
Copy Markdown
Contributor Author

@timsaucer did you have any thoughts on the namespaces because going from this to that would wind up being a breaking change.

@timsaucer

Copy link
Copy Markdown
Member

At a high level I like some of the aspects of a namespace. It would especially be nice to clean up our documentation using them in functions. I haven't thought through what this would mean for organizing both functions and in Expr. We would at least need to have some helper functions marked as deprecated for a few releases if we did this. It's a really good suggestion, but I just want to make sure we have a consistent story across the repo. I haven't looked into how we could do this in PyO3 or if it would just be in the wrappers.

@timsaucer timsaucer merged commit 5a7f638 into apache:main Apr 27, 2025
@timsaucer

Copy link
Copy Markdown
Member

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.

2 participants