Skip to content

Apache DataFusion SQL Query Engine

Make SQL query consistent with API syntax expression in code examples (#5303)

Chih Wangfd75ba461d59
diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs
index bb8c8ff097..1bbd9a0ebf 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 03283a408c..c497c66e59 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?;