alamb commented on code in PR #4908:
URL: https://github.com/apache/arrow-datafusion/pull/4908#discussion_r1111057255
##########
datafusion/core/src/execution/context.rs:
##########
@@ -124,6 +161,7 @@ use super::options::{
/// # #[tokio::main]
/// # async fn main() -> Result<()> {
/// let ctx = SessionContext::new();
+/// let df = ctx.read_csv(vec!["tests/data/example.csv",
"tests/data/example.csv"], CsvReadOptions::new()).await?;
Review Comment:
I think this particular line is just confusing -- the next line ignores the
result (redefines `df`) and it registers the same file twice. Given this is
supposed to be the simplest example, I think we should leave this one alone.
##########
datafusion/core/src/execution/context.rs:
##########
@@ -685,24 +723,40 @@ impl SessionContext {
///
/// For more control such as reading multiple files, you can use
/// [`read_table`](Self::read_table) with a [`ListingTable`].
- pub async fn read_csv(
+ ///
+ /// Example usage is given below:
+ ///
+ /// ```
+ /// use datafusion::prelude::*;
+ /// # use datafusion::error::Result;
+ /// # #[tokio::main]
+ /// # async fn main() -> Result<()> {
+ /// let ctx = SessionContext::new();
+ /// let df = ctx.read_csv("tests/data/example.csv",
CsvReadOptions::new()).await?;
+ /// let df = ctx.read_csv(vec!["tests/data/example.csv",
"tests/data/example.csv"], CsvReadOptions::new()).await?;
Review Comment:
```suggestion
/// // You can read a single file using `read_csv`
/// let df = ctx.read_csv("tests/data/example.csv",
CsvReadOptions::new()).await?;
/// // you can also read multiple files:
/// let df = ctx.read_csv(vec!["tests/data/example.csv",
"tests/data/example.csv"], CsvReadOptions::new()).await?;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]