-
Notifications
You must be signed in to change notification settings - Fork 129
feat: expose select_exprs
method on DataFrame
#1271
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
base: main
Are you sure you want to change the base?
Conversation
def select_exprs(self, *args: str) -> DataFrame: | ||
"""Project arbitrary list of expression strings into a new DataFrame. Method will parse string expressions into logical plan expressions. | ||
The output DataFrame has one column for each element in exprs. | ||
Returns: | ||
DataFrame only containing the specified columns. | ||
""" | ||
return self.df.select_exprs(*args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will fail the ruff
linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed, will follow up later if it fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. We need CI to show green and then I'll merge.
thanks @timsaucer |
I fixed the lint error. Thank you for the PR! I will merge as soon as I see CI finish. |
you were three minutes faster than me fixing it :) thanks @timsaucer maybe we could expose
as a first step, not sure what do you think ? |
Which issue does this PR close?
Closes #1270 .
Rationale for this change
Expose DataFrame.select_exprs method, which is supported in DataFusion, this method is similar to pyspark.select_expr
Method will parse string expressions into logical plan expressions, making easier to create select statements when expressions are involved
It would be ideal if we could support expressions on df.select(...) but that change looked as a bit complicated for me.
What changes are included in this PR?
Are there any user-facing changes?