jorgecarleitao commented on a change in pull request #9703:
URL: https://github.com/apache/arrow/pull/9703#discussion_r599591740
##########
File path: rust/datafusion/src/logical_plan/builder.rs
##########
@@ -39,6 +39,43 @@ use crate::logical_plan::{DFField, DFSchema, DFSchemaRef,
Partitioning};
use std::collections::HashSet;
/// Builder for logical plans
+///
+/// ```
+/// # use datafusion::prelude::*;
+/// # use datafusion::logical_plan::LogicalPlanBuilder;
+/// # use datafusion::error::Result;
+/// # use arrow::datatypes::{Schema, DataType, Field};
+/// #
+/// # fn main() -> Result<()> {
+/// #
+/// # fn employee_schema() -> Schema {
+/// # Schema::new(vec![
+/// # Field::new("id", DataType::Int32, false),
+/// # Field::new("first_name", DataType::Utf8, false),
+/// # Field::new("last_name", DataType::Utf8, false),
+/// # Field::new("state", DataType::Utf8, false),
+/// # Field::new("salary", DataType::Int32, false),
+/// # ])
+/// # }
+/// #
+/// // Create a plan similar to
+/// // SELECT last_name
+/// // FROM employees
+/// // WHERE salary < 1000
+/// let plan = LogicalPlanBuilder::scan_empty(
+/// "employee.csv",
+/// &employee_schema(),
+/// None,
+/// )?
+/// // Keep only rows where salary < 1000
+/// .filter(col("salary").lt_eq(lit(1000)))?
+/// // only show "last_name" in the final results
+/// .project(vec![col("last_name")])?
Review comment:
This will be even sweater once `IntoIter` is supported for arrays:
`[col()]` vs `vec![col()]`, see https://github.com/rust-lang/rust/pull/65819
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]