docs: 📝 Add expected answers to DataFrame method examples#12564
docs: 📝 Add expected answers to DataFrame method examples#12564comphead merged 3 commits intoapache:mainfrom
DataFrame method examples#12564Conversation
datafusion/core/src/dataframe/mod.rs
Outdated
| /// let ctx = SessionContext::new(); | ||
| /// let df = ctx.read_csv("tests/data/example.csv", CsvReadOptions::new()).await?; | ||
| /// let df = df.select_columns(&["a", "b"])?; | ||
| /// df.select_columns(&["a", "b"])?.show().await?; |
There was a problem hiding this comment.
What would you think about using assert_batches_eq instead so that the output is automatically checked as part of the doc tests rather than relying on us manually keeping it up to date?
It is of similar readability I think. Here is an example:
datafusion/datafusion/core/tests/sql/select.rs
Lines 27 to 49 in d9cb6e6
There was a problem hiding this comment.
My original thought is to simplify large long column on doctest(less readable), like this: https://github.com/Eason0729/datafusion/blob/4dd44c5a2b0d9810d7e9163689afab227c58d542/datafusion/core/src/dataframe/mod.rs#L734
Therefore, I simplify example_long.csv in the next commit to the point which is just enough to showcase most method on dataframe.
There was a problem hiding this comment.
But the expect behavior on describe method is more complex, which might require dedicated csv, so I decided to leave as it is.
alamb
left a comment
There was a problem hiding this comment.
Thank you so much @Eason0729 for this contribution 🙏
I have started the CI to check this code
I think the PR would be even better if the output was verified (so it is guaranteed to stay in sync). I left a suggestion on how to do this. Let me know what you think
|
|
||
| /// Creates logical expression from a SQL query text. | ||
| /// The expression is created and processed againt the current schema. | ||
| /// The expression is created and processed against the current schema. |
|
Thanks @Eason0729 for your contribution. Underneath the method can call |
Co-authored-by: Oleks V <[email protected]>
This seems reasonable to me -- perhaps you can file a ticket to track the idea and we can as our resident DataFrame experts like @timsaucer and @Omega359 |
|
Thanks again @Eason0729 |
|
📝 |
…2564) * docs: 📝 Add expected answers to `DataFrame` method examples * test: 📝 use assert_batches_sorted_eq and simplify example_long.csv * Update datafusion/core/src/dataframe/mod.rs Co-authored-by: Oleks V <[email protected]> --------- Co-authored-by: Andrew Lamb <[email protected]> Co-authored-by: Oleks V <[email protected]>
Which issue does this PR close?
Closes #12527.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?