[][src]Struct datafusion::execution::context::ExecutionContext

pub struct ExecutionContext { /* fields omitted */ }

Execution context for registering data sources and executing queries

Methods

impl ExecutionContext[src]

pub fn new() -> Self[src]

Create a new execution context for in-memory queries

pub fn sql(&mut self, sql: &str, batch_size: usize) -> Result<Vec<RecordBatch>>[src]

Execute a SQL query and produce a Relation (a schema-aware iterator over a series of RecordBatch instances)

pub fn create_logical_plan(&mut self, sql: &str) -> Result<Arc<LogicalPlan>>[src]

Creates a logical plan

pub fn register_csv(
    &mut self,
    name: &str,
    filename: &str,
    schema: &Schema,
    has_header: bool
)
[src]

Register a CSV file as a table so that it can be queried from SQL

pub fn register_parquet(&mut self, name: &str, filename: &str) -> Result<()>[src]

Register a Parquet file as a table so that it can be queried from SQL

pub fn register_table(&mut self, name: &str, provider: Box<dyn TableProvider>)[src]

Register a table so that it can be queried from SQL

pub fn table(&mut self, table_name: &str) -> Result<Arc<dyn Table>>[src]

Get a table by name

pub fn optimize(&self, plan: &LogicalPlan) -> Result<Arc<LogicalPlan>>[src]

Optimize the logical plan by applying optimizer rules

pub fn create_physical_plan(
    &mut self,
    logical_plan: &Arc<LogicalPlan>,
    batch_size: usize
) -> Result<Arc<dyn ExecutionPlan>>
[src]

Create a physical plan from a logical plan

pub fn create_physical_expr(
    &self,
    e: &Expr,
    input_schema: &Schema
) -> Result<Arc<dyn PhysicalExpr>>
[src]

Create a physical expression from a logical expression

pub fn create_aggregate_expr(
    &self,
    e: &Expr,
    input_schema: &Schema
) -> Result<Arc<dyn AggregateExpr>>
[src]

Create an aggregate expression from a logical expression

pub fn collect(&self, plan: &dyn ExecutionPlan) -> Result<Vec<RecordBatch>>[src]

Execute a physical plan and collect the results in memory

pub fn write_csv(&self, plan: &dyn ExecutionPlan, path: &str) -> Result<()>[src]

Execute a query and write the results to a partitioned CSV file

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, U> Cast<U> for T where
    U: FromCast<T>, 

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

impl<T> FromCast<T> for T

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

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<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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