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 2023/02/16 18:44:42 UTC

[arrow-datafusion] branch main updated: Make SQL query consistent with API syntax expression in code examples (#5303)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new fd75ba461 Make SQL query consistent with API syntax expression in code examples (#5303)
fd75ba461 is described below

commit fd75ba461d59bff10adc9c16cead241565c2d2f2
Author: Chih Wang <on...@users.noreply.github.com>
AuthorDate: Fri Feb 17 02:44:36 2023 +0800

    Make SQL query consistent with API syntax expression in code examples (#5303)
    
    * Update code example
    
    Make SQL query consistent with API syntax expression.
    
    * Update example in core/src/lib.rs
---
 datafusion/core/src/lib.rs              | 2 +-
 docs/source/user-guide/example-usage.md | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs
index bb8c8ff09..1bbd9a0eb 100644
--- a/datafusion/core/src/lib.rs
+++ b/datafusion/core/src/lib.rs
@@ -78,7 +78,7 @@
 //! ctx.register_csv("example", "tests/data/example.csv", CsvReadOptions::new()).await?;
 //!
 //! // create a plan
-//! let df = ctx.sql("SELECT a, MIN(b) FROM example GROUP BY a LIMIT 100").await?;
+//! let df = ctx.sql("SELECT a, MIN(b) FROM example WHERE a <= b GROUP BY a LIMIT 100").await?;
 //!
 //! // execute the plan
 //! let results: Vec<RecordBatch> = df.collect().await?;
diff --git a/docs/source/user-guide/example-usage.md b/docs/source/user-guide/example-usage.md
index 03283a408..c497c66e5 100644
--- a/docs/source/user-guide/example-usage.md
+++ b/docs/source/user-guide/example-usage.md
@@ -42,7 +42,7 @@ async fn main() -> datafusion::error::Result<()> {
   ctx.register_csv("example", "tests/data/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").await?;
+  let df = ctx.sql("SELECT a, MIN(b) FROM example WHERE a <= b GROUP BY a LIMIT 100").await?;
 
   // execute and print results
   df.show().await?;
@@ -99,7 +99,7 @@ async fn main() -> datafusion::error::Result<()> {
   ctx.register_csv("example", "tests/data/capitalized_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").await?;
+  let df = ctx.sql("SELECT \"A\", MIN(b) FROM example WHERE \"A\" <= c GROUP BY \"A\" LIMIT 100").await?;
 
   // execute and print results
   df.show().await?;