[][src]Enum datafusion::logical_plan::LogicalPlan

pub enum LogicalPlan {
    Projection {
        expr: Vec<Expr>,
        input: Arc<LogicalPlan>,
        schema: SchemaRef,
    },
    Filter {
        predicate: Expr,
        input: Arc<LogicalPlan>,
    },
    Aggregate {
        input: Arc<LogicalPlan>,
        group_expr: Vec<Expr>,
        aggr_expr: Vec<Expr>,
        schema: SchemaRef,
    },
    Sort {
        expr: Vec<Expr>,
        input: Arc<LogicalPlan>,
    },
    TableScan {
        schema_name: String,
        table_name: String,
        table_schema: SchemaRef,
        projection: Option<Vec<usize>>,
        projected_schema: SchemaRef,
    },
    InMemoryScan {
        data: Vec<Vec<RecordBatch>>,
        schema: SchemaRef,
        projection: Option<Vec<usize>>,
        projected_schema: SchemaRef,
    },
    ParquetScan {
        path: String,
        schema: SchemaRef,
        projection: Option<Vec<usize>>,
        projected_schema: SchemaRef,
    },
    CsvScan {
        path: String,
        schema: SchemaRef,
        has_header: bool,
        delimiter: Option<u8>,
        projection: Option<Vec<usize>>,
        projected_schema: SchemaRef,
    },
    EmptyRelation {
        schema: SchemaRef,
    },
    Limit {
        n: usize,
        input: Arc<LogicalPlan>,
    },
    CreateExternalTable {
        schema: SchemaRef,
        name: String,
        location: String,
        file_type: FileType,
        has_header: bool,
    },
    Explain {
        verbose: bool,
        plan: Arc<LogicalPlan>,
        stringified_plans: Vec<StringifiedPlan>,
        schema: SchemaRef,
    },
    Extension {
        node: Arc<dyn UserDefinedLogicalNode + Send + Sync>,
    },
}

A LogicalPlan represents the different types of relational operators (such as Projection, Filter, etc) and can be created by the SQL query planner and the DataFrame API.

A LogicalPlan represents transforming an input relation (table) to an output relation (table) with a (potentially) different schema. A plan represents a dataflow tree where data flows from leaves up to the root to produce the query result.

Variants

Projection

Evaluates an arbitrary list of expressions (essentially a SELECT with an expression list) on its input.

Fields of Projection

expr: Vec<Expr>

The list of expressions

input: Arc<LogicalPlan>

The incoming logical plan

schema: SchemaRef

The schema description of the output

Filter

Filters rows from its input that do not match an expression (essentially a WHERE clause with a predicate expression).

Semantically, <predicate> is evaluated for each row of the input; If the value of <predicate> is true, the input row is passed to the output. If the value of <predicate> is false, the row is discarded.

Fields of Filter

predicate: Expr

The predicate expression, which must have Boolean type.

input: Arc<LogicalPlan>

The incoming logical plan

Aggregate

Aggregates its input based on a set of grouping and aggregate expressions (e.g. SUM).

Fields of Aggregate

input: Arc<LogicalPlan>

The incoming logical plan

group_expr: Vec<Expr>

Grouping expressions

aggr_expr: Vec<Expr>

Aggregate expressions

schema: SchemaRef

The schema description of the aggregate output

Sort

Sorts its input according to a list of sort expressions.

Fields of Sort

expr: Vec<Expr>

The sort expressions

input: Arc<LogicalPlan>

The incoming logical plan

TableScan

Produces rows from a table that has been registered on a context

Fields of TableScan

schema_name: String

The name of the schema

table_name: String

The name of the table

table_schema: SchemaRef

The schema of the CSV file(s)

projection: Option<Vec<usize>>

Optional column indices to use as a projection

projected_schema: SchemaRef

The schema description of the output

InMemoryScan

Produces rows that come from a Vec of in memory RecordBatches

Fields of InMemoryScan

data: Vec<Vec<RecordBatch>>

Record batch partitions

schema: SchemaRef

The schema of the record batches

projection: Option<Vec<usize>>

Optional column indices to use as a projection

projected_schema: SchemaRef

The schema description of the output

ParquetScan

Produces rows by scanning Parquet file(s)

Fields of ParquetScan

path: String

The path to the files

schema: SchemaRef

The schema of the Parquet file(s)

projection: Option<Vec<usize>>

Optional column indices to use as a projection

projected_schema: SchemaRef

The schema description of the output

CsvScan

Produces rows by scanning a CSV file(s)

Fields of CsvScan

path: String

The path to the files

schema: SchemaRef

The underlying table schema

has_header: bool

Whether the CSV file(s) have a header containing column names

delimiter: Option<u8>

An optional column delimiter. Defaults to b','

projection: Option<Vec<usize>>

Optional column indices to use as a projection

projected_schema: SchemaRef

The schema description of the output

EmptyRelation

Produces no rows: An empty relation with an empty schema

Fields of EmptyRelation

schema: SchemaRef

The schema description of the output

Limit

Produces the first n tuples from its input and discards the rest.

Fields of Limit

n: usize

The limit

input: Arc<LogicalPlan>

The logical plan

CreateExternalTable

Creates an external table.

Fields of CreateExternalTable

schema: SchemaRef

The table schema

name: String

The table name

location: String

The physical location

file_type: FileType

The file type of physical file

has_header: bool

Whether the CSV file contains a header

Explain

Produces a relation with string representations of various parts of the plan

Fields of Explain

verbose: bool

Should extra (detailed, intermediate plans) be included?

plan: Arc<LogicalPlan>

The logical plan that is being EXPLAIN'd

stringified_plans: Vec<StringifiedPlan>

Represent the various stages plans have gone through

schema: SchemaRef

The output schema of the explain (2 columns of text)

Extension

Extension operator defined outside of DataFusion

Fields of Extension

node: Arc<dyn UserDefinedLogicalNode + Send + Sync>

The runtime extension operator

Implementations

impl LogicalPlan[src]

pub fn schema(&self) -> &SchemaRef[src]

Get a reference to the logical plan's schema

pub fn explain_schema() -> SchemaRef[src]

Returns the (fixed) output schema for explain plans

Trait Implementations

impl Clone for LogicalPlan[src]

impl Debug for LogicalPlan[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,