You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/02/16 19:35:21 UTC

[arrow-datafusion] branch master updated: Update documentation example for change in API (#1812)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a5a431  Update documentation example for change in API (#1812)
2a5a431 is described below

commit 2a5a43195c6e7fecda613f89df80d4079b8dea6b
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Feb 16 14:35:13 2022 -0500

    Update documentation example for change in API (#1812)
    
    * Update documentation example for change in API
    
    * Update docs/source/user-guide/example-usage.md
    
    * Update docs/source/user-guide/example-usage.md
    
    Co-authored-by: xudong.w <wx...@gmail.com>
    
    Co-authored-by: xudong.w <wx...@gmail.com>
---
 docs/source/user-guide/example-usage.md | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/docs/source/user-guide/example-usage.md b/docs/source/user-guide/example-usage.md
index c09e1e8..7793026 100644
--- a/docs/source/user-guide/example-usage.md
+++ b/docs/source/user-guide/example-usage.md
@@ -19,7 +19,16 @@
 
 # Example Usage
 
-Run a SQL query against data stored in a CSV:
+## Update `Cargo.toml`
+
+Add the following to your `Cargo.toml` file:
+
+```toml
+datafusion = "7.0.0"
+tokio = "1.0"
+```
+
+## Run a SQL query against data stored in a CSV:
 
 ```rust
 use datafusion::prelude::*;
@@ -28,10 +37,10 @@ use datafusion::prelude::*;
 async fn main() -> datafusion::error::Result<()> {
   // register the table
   let mut ctx = ExecutionContext::new();
-  ctx.register_csv("example", "tests/example.csv", CsvReadOptions::new())?;
+  ctx.register_csv("example", "tests/example.csv", CsvReadOptions::new()).await?;
 
   // create a plan to run a SQL query
-  let df = ctx.sql("SELECT a, MIN(b) FROM example GROUP BY a LIMIT 100")?;
+  let df = ctx.sql("SELECT a, MIN(b) FROM example GROUP BY a LIMIT 100").await?;
 
   // execute and print results
   df.show().await?;
@@ -39,7 +48,7 @@ async fn main() -> datafusion::error::Result<()> {
 }
 ```
 
-Use the DataFrame API to process data stored in a CSV:
+## Use the DataFrame API to process data stored in a CSV:
 
 ```rust
 use datafusion::prelude::*;
@@ -48,7 +57,7 @@ use datafusion::prelude::*;
 async fn main() -> datafusion::error::Result<()> {
   // create the dataframe
   let mut ctx = ExecutionContext::new();
-  let df = ctx.read_csv("tests/example.csv", CsvReadOptions::new())?;
+  let df = ctx.read_csv("tests/example.csv", CsvReadOptions::new()).await?;
 
   let df = df.filter(col("a").lt_eq(col("b")))?
            .aggregate(vec![col("a")], vec![min(col("b"))])?;
@@ -59,7 +68,7 @@ async fn main() -> datafusion::error::Result<()> {
 }
 ```
 
-Both of these examples will produce
+## Output from both examples
 
 ```text
 +---+--------+