Skip to content

Commit

Permalink
impored document string for plan builder (#10496)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrarNitk authored May 14, 2024
1 parent 0c5d72b commit 424757f
Showing 1 changed file with 22 additions and 10 deletions.
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 @@ -1147,22 +1147,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

0 comments on commit 424757f

Please sign in to comment.