Parser

Struct Parser 

Source
struct Parser<'a> {
    val: &'a str,
    tokenizer: Peekable<Tokenizer<'a>>,
}
Expand description

Implementation of parse_data_type, modeled after https://github.com/sqlparser-rs/sqlparser-rs

Fields§

§val: &'a str§tokenizer: Peekable<Tokenizer<'a>>

Implementations§

Source§

impl<'a> Parser<'a>

Source

fn new(val: &'a str) -> Self

Source

fn parse(self) -> Result<DataType, ArrowError>

Source

fn parse_next_type(&mut self) -> Result<DataType, ArrowError>

parses the next full DataType

Source

fn parse_field(&mut self) -> Result<Field, ArrowError>

parses Field, this is the inversion of format_field in datatype_display.rs. E.g: “a”: non-null Int64

TODO: support metadata: "a": non-null Int64 metadata: {"foo": "value"}

Source

fn parse_list_field(&mut self, context: &str) -> Result<Field, ArrowError>

Parses field inside a list. Use Field::LIST_FIELD_DEFAULT_NAME if no field name is specified. E.g: non-null Int64, field: 'foo' or non-null Int64

TODO: support metadata: non-ull Int64, metadata: {"foo2": "value"}

Source

fn parse_list(&mut self) -> Result<DataType, ArrowError>

Parses the List type (called after List has been consumed) E.g: List(non-null Int64, field: ‘foo’)

Source

fn parse_list_view(&mut self) -> Result<DataType, ArrowError>

Parses the ListView type (called after ListView has been consumed) E.g: ListView(non-null Int64, field: ‘foo’)

Source

fn parse_large_list(&mut self) -> Result<DataType, ArrowError>

Parses the LargeList type (called after LargeList has been consumed) E.g: LargeList(non-null Int64, field: ‘foo’)

Source

fn parse_large_list_view(&mut self) -> Result<DataType, ArrowError>

Parses the LargeListView type (called after LargeListView has been consumed) E.g: LargeListView(non-null Int64, field: ‘foo’)

Source

fn parse_fixed_size_list(&mut self) -> Result<DataType, ArrowError>

Parses the FixedSizeList type (called after FixedSizeList has been consumed)

Examples:

  • FixedSizeList(5 x non-null Int64, field: 'foo')
  • FixedSizeList(4, Int64)
Source

fn parse_time_unit(&mut self, context: &str) -> Result<TimeUnit, ArrowError>

Parses the next timeunit

Source

fn parse_double_quoted_string( &mut self, context: &str, ) -> Result<String, ArrowError>

Parses the next double quoted string

Source

fn parse_single_quoted_string( &mut self, context: &str, ) -> Result<String, ArrowError>

Parses the next single quoted string

Source

fn parse_i64(&mut self, context: &str) -> Result<i64, ArrowError>

Parses the next integer value

Source

fn parse_i32(&mut self, context: &str) -> Result<i32, ArrowError>

Parses the next i32 integer value

Source

fn parse_i8(&mut self, context: &str) -> Result<i8, ArrowError>

Parses the next i8 integer value

Source

fn parse_u8(&mut self, context: &str) -> Result<u8, ArrowError>

Parses the next u8 integer value

Source

fn parse_timestamp(&mut self) -> Result<DataType, ArrowError>

Parses the next timestamp (called after Timestamp has been consumed)

Source

fn parse_time32(&mut self) -> Result<DataType, ArrowError>

Parses the next Time32 (called after Time32 has been consumed)

Source

fn parse_time64(&mut self) -> Result<DataType, ArrowError>

Parses the next Time64 (called after Time64 has been consumed)

Source

fn parse_duration(&mut self) -> Result<DataType, ArrowError>

Parses the next Duration (called after Duration has been consumed)

Source

fn parse_interval(&mut self) -> Result<DataType, ArrowError>

Parses the next Interval (called after Interval has been consumed)

Source

fn parse_fixed_size_binary(&mut self) -> Result<DataType, ArrowError>

Parses the next FixedSizeBinary (called after FixedSizeBinary has been consumed)

Source

fn parse_decimal_32(&mut self) -> Result<DataType, ArrowError>

Parses the next Decimal32 (called after Decimal32 has been consumed)

Source

fn parse_decimal_64(&mut self) -> Result<DataType, ArrowError>

Parses the next Decimal64 (called after Decimal64 has been consumed)

Source

fn parse_decimal_128(&mut self) -> Result<DataType, ArrowError>

Parses the next Decimal128 (called after Decimal128 has been consumed)

Source

fn parse_decimal_256(&mut self) -> Result<DataType, ArrowError>

Parses the next Decimal256 (called after Decimal256 has been consumed)

Source

fn parse_dictionary(&mut self) -> Result<DataType, ArrowError>

Parses the next Dictionary (called after Dictionary has been consumed)

Source

fn parse_struct(&mut self) -> Result<DataType, ArrowError>

Parses the next Struct (called after Struct has been consumed)

Source

fn parse_union(&mut self) -> Result<DataType, ArrowError>

Parses the next Union (called after Union has been consumed) E.g: Union(Sparse, 0: (“a”: Int32), 1: (“b”: non-null Utf8))

Source

fn parse_union_mode(&mut self) -> Result<UnionMode, ArrowError>

Parses the next UnionMode

Source

fn parse_union_field(&mut self) -> Result<(i8, Field), ArrowError>

Parses the next UnionField 0: (“a”: non-null Int32)

Source

fn parse_map(&mut self) -> Result<DataType, ArrowError>

Parses the next Map (called after Map has been consumed) E.g: Map(“entries”: Struct(“key”: Utf8, “value”: non-null Int32), sorted)

Source

fn parse_map_sorted(&mut self) -> Result<bool, ArrowError>

Parses map’s sorted

Source

fn parse_run_end_encoded(&mut self) -> Result<DataType, ArrowError>

Parses the next RunEndEncoded (called after RunEndEncoded has been consumed) E.g: RunEndEncoded(“run_ends”: UInt32, “values”: nonnull Int32)

Source

fn parse_opt_nullable(&mut self) -> bool

consume the next token and return false if the field is nonnull.

Source

fn next_token(&mut self) -> Result<Token, ArrowError>

return the next token, or an error if there are none left

Source

fn expect_token(&mut self, tok: Token) -> Result<(), ArrowError>

consume the next token, returning OK(()) if it matches tok, and Err if not

Trait Implementations§

Source§

impl<'a> Debug for Parser<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

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

§

impl<'a> Send for Parser<'a>

§

impl<'a> Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

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

Blanket Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.