Skip to main content

DFParser

Struct DFParser 

Source
pub struct DFParser<'a> {
    pub parser: Parser<'a>,
    /* private fields */
}
Expand description

DataFusion SQL Parser based on sqlparser

Parses DataFusion’s SQL dialect, often delegating to sqlparser’s Parser.

DataFusion mostly follows existing SQL dialects via sqlparser. However, certain statements such as COPY and CREATE EXTERNAL TABLE have special syntax in DataFusion. See Statement for a list of this special syntax

Fields§

§parser: Parser<'a>

Implementations§

Source§

impl<'a> DFParser<'a>

Source

pub fn new(sql: &'a str) -> Result<DFParser<'a>, DataFusionError>

👎Deprecated since 46.0.0:

DFParserBuilder

Source

pub fn new_with_dialect( sql: &'a str, dialect: &'a (dyn Dialect + 'static), ) -> Result<DFParser<'a>, DataFusionError>

👎Deprecated since 46.0.0:

DFParserBuilder

Source

pub fn parse_sql(sql: &'a str) -> Result<VecDeque<Statement>, DataFusionError>

Parse a sql string into one or Statements using the GenericDialect.

Source

pub fn parse_sql_with_dialect( sql: &str, dialect: &(dyn Dialect + 'static), ) -> Result<VecDeque<Statement>, DataFusionError>

Parse a SQL string and produce one or more Statements with with the specified dialect.

Source

pub fn parse_sql_into_expr(sql: &str) -> Result<ExprWithAlias, DataFusionError>

Source

pub fn parse_sql_into_expr_with_dialect( sql: &str, dialect: &(dyn Dialect + 'static), ) -> Result<ExprWithAlias, DataFusionError>

Source

pub fn parse_statements( &mut self, ) -> Result<VecDeque<Statement>, DataFusionError>

Parse a sql string into one or Statements

Source

pub fn parse_statement(&mut self) -> Result<Statement, DataFusionError>

Parse a new expression

Source

pub fn parse_expr(&mut self) -> Result<ExprWithAlias, DataFusionError>

Source

pub fn parse_into_expr(&mut self) -> Result<ExprWithAlias, DataFusionError>

Parses the entire SQL string into an expression.

In contrast to DFParser::parse_expr, this function will report an error if the input contains any trailing, unparsed tokens.

Source

pub fn parse_copy(&mut self) -> Result<Statement, DataFusionError>

Parse a SQL COPY TO statement

Source

pub fn parse_option_key(&mut self) -> Result<String, DataFusionError>

Parse the next token as a key name for an option list

Note this is different than parse_literal_string because it allows keywords as well as other non words

Source

pub fn parse_option_value(&mut self) -> Result<Value, DataFusionError>

Parse the next token as a value for an option list

Note this is different than parse_value as it allows any word or keyword in this location.

Source

pub fn parse_explain(&mut self) -> Result<Statement, DataFusionError>

Parse a SQL EXPLAIN

Source

pub fn parse_reset(&mut self) -> Result<Statement, DataFusionError>

Parse a SQL RESET

Source

pub fn parse_explain_format( &mut self, ) -> Result<Option<String>, DataFusionError>

Source

pub fn parse_create(&mut self) -> Result<Statement, DataFusionError>

Parse a SQL CREATE statement handling CREATE EXTERNAL TABLE

Source

pub fn parse_order_by_exprs( &mut self, ) -> Result<Vec<OrderByExpr>, DataFusionError>

Parse the ordering clause of a CREATE EXTERNAL TABLE SQL statement

Source

pub fn parse_order_by_expr(&mut self) -> Result<OrderByExpr, DataFusionError>

Parse an ORDER BY sub-expression optionally followed by ASC or DESC.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for DFParser<'a>

§

impl<'a> !Send for DFParser<'a>

§

impl<'a> !Sync for DFParser<'a>

§

impl<'a> !UnwindSafe for DFParser<'a>

§

impl<'a> Freeze for DFParser<'a>

§

impl<'a> Unpin for DFParser<'a>

§

impl<'a> UnsafeUnpin for DFParser<'a>

Blanket Implementations§

Source§

impl<Source> AccessAs for Source

Source§

fn ref_as<T>(&self) -> <Source as IGuardRef<T>>::Guard<'_>
where Source: IGuardRef<T>, T: ?Sized,

Provides immutable access to a type as if it were its ABI-unstable equivalent.
Source§

fn mut_as<T>(&mut self) -> <Source as IGuardMut<T>>::GuardMut<'_>
where Source: IGuardMut<T>, T: ?Sized,

Provides mutable access to a type as if it were its ABI-unstable equivalent.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, As> IGuardMut<As> for T
where T: Into<As>, As: Into<T>,

Source§

type GuardMut<'a> = MutAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary after applying its changes to the original.
Source§

fn guard_mut_inner(&mut self) -> <T as IGuardMut<As>>::GuardMut<'_>

Construct the temporary and guard it through a mutable reference.
Source§

impl<T, As> IGuardRef<As> for T
where T: Into<As>, As: Into<T>,

Source§

type Guard<'a> = RefAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary.
Source§

fn guard_ref_inner(&self) -> <T as IGuardRef<As>>::Guard<'_>

Construct the temporary and guard it through an immutable reference.
Source§

impl<T> Includes<End> for T

Source§

type Output = End

The result
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more