-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
ARROW-9760: [Rust] [DataFusion] Added DataFrame::explain #7993
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andygrove
reviewed
Aug 18, 2020
alamb
approved these changes
Aug 18, 2020
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.
The implementation looks good to me. I don't have any strong opinion or feedback on the API design
That makes sense to me
…On Tue, Aug 18, 2020 at 11:24 PM Jorge Leitao ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In rust/datafusion/src/dataframe.rs
<#7993 (comment)>:
> @@ -174,4 +174,18 @@ pub trait DataFrame {
/// Return the logical plan represented by this DataFrame.
fn to_logical_plan(&self) -> LogicalPlan;
+
+ /// Return a DataFrame with the explanation of its plan so far.
+ ///
+ /// ```
+ /// # use datafusion::prelude::*;
+ /// # use datafusion::error::Result;
+ /// # fn main() -> Result<()> {
+ /// let mut ctx = ExecutionContext::new();
+ /// let df = ctx.read_csv("tests/example.csv", CsvReadOptions::new())?;
+ /// let batches = df.limit(100)?.explain(false)?.collect()?;
+ /// # Ok(())
+ /// # }
+ /// ```
+ fn explain(&self, verbose: bool) -> Result<Arc<dyn DataFrame>>;
I find it poor design that .explain prints directly to the stdout in
spark. IMO saving 1 extra line (print) of code is not a sufficiently good
reason to outright spam stdout and limit so much what a user can do with
.explain.
Some downstream consequences of this decision in spark:
- it makes it much more difficult to log it correctly
- the popular pyspark can't use it to convert it to a Python string
and prettify it when it is being used in notebooks
I agree with fn explain(&self, verbose: bool) -> String (prob.
Result<String>). For a user, the difference is
df.explain()
vs
println("{}", df.explain()?)
I find the latter more expressive of the user's intention, and gives them
the freedom to pipe the result to whatever stream they want.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7993 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADXZMJFG5NSF3L4FDEOIT3SBNAWNANCNFSM4QD6L7YA>
.
|
After thinking about this some more, I'm also fine with the current implementation that returns a DataFrame. |
andygrove
approved these changes
Aug 19, 2020
emkornfield
pushed a commit
to emkornfield/arrow
that referenced
this pull request
Sep 8, 2020
FYI @andygrove and @alamb I admit I find this API a bit counter-intuitive: coming from spark, I would be expect a string when I call `df.explain()?`. However, I am following the commitment of understanding `explain` as a table with one row and one column and leave the collect and print for the users to handle. Closes apache#7993 from jorgecarleitao/df_explain Authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
emkornfield
pushed a commit
to emkornfield/arrow
that referenced
this pull request
Oct 16, 2020
FYI @andygrove and @alamb I admit I find this API a bit counter-intuitive: coming from spark, I would be expect a string when I call `df.explain()?`. However, I am following the commitment of understanding `explain` as a table with one row and one column and leave the collect and print for the users to handle. Closes apache#7993 from jorgecarleitao/df_explain Authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
GeorgeAp
pushed a commit
to sirensolutions/arrow
that referenced
this pull request
Jun 7, 2021
FYI @andygrove and @alamb I admit I find this API a bit counter-intuitive: coming from spark, I would be expect a string when I call `df.explain()?`. However, I am following the commitment of understanding `explain` as a table with one row and one column and leave the collect and print for the users to handle. Closes apache#7993 from jorgecarleitao/df_explain Authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com> Signed-off-by: Andy Grove <andygrove73@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FYI @andygrove and @alamb
I admit I find this API a bit counter-intuitive: coming from spark, I would be expect a string when I call
df.explain()?
. However, I am following the commitment of understandingexplain
as a table with one row and one column and leave the collect and print for the users to handle.