Skip to content

Minor: Improved document string for LogicalPlanBuilder #10496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions datafusion/expr/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,22 +1141,34 @@ impl LogicalPlanBuilder {
}

/// Converts a `Arc<LogicalPlan>` into `LogicalPlanBuilder`
/// 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),
/// ])
/// }
/// ```
/// # use datafusion_expr::{Expr, expr, col, LogicalPlanBuilder, logical_plan::table_scan};
/// # use datafusion_common::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 the plan
/// let plan = table_scan(Some("employee_csv"), &employee_schema(), Some(vec![3, 4]))?
/// .sort(vec![
/// Expr::Sort(expr::Sort::new(Box::new(col("state")), true, true)),
/// Expr::Sort(expr::Sort::new(Box::new(col("salary")), false, false)),
/// ])?
/// .build()?;
/// let plan_builder: LogicalPlanBuilder = Arc::new(plan).into();
/// // Convert LogicalPlan into LogicalPlanBuilder
/// let plan_builder: LogicalPlanBuilder = std::sync::Arc::new(plan).into();
/// # Ok(())
/// # }
/// ```

impl From<Arc<LogicalPlan>> for LogicalPlanBuilder {
fn from(plan: Arc<LogicalPlan>) -> Self {
Expand Down
Loading