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>
impl<'a> Parser<'a>
fn new(val: &'a str) -> Self
fn parse(self) -> Result<DataType, ArrowError>
Sourcefn parse_next_type(&mut self) -> Result<DataType, ArrowError>
fn parse_next_type(&mut self) -> Result<DataType, ArrowError>
parses the next full DataType
Sourcefn parse_field(&mut self) -> Result<Field, ArrowError>
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"}
Sourcefn parse_list_field(&mut self, context: &str) -> Result<Field, ArrowError>
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"}
Sourcefn parse_list(&mut self) -> Result<DataType, ArrowError>
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’)
Sourcefn parse_list_view(&mut self) -> Result<DataType, ArrowError>
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’)
Sourcefn parse_large_list(&mut self) -> Result<DataType, ArrowError>
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’)
Sourcefn parse_large_list_view(&mut self) -> Result<DataType, ArrowError>
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’)
Sourcefn parse_fixed_size_list(&mut self) -> Result<DataType, ArrowError>
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)
Sourcefn parse_time_unit(&mut self, context: &str) -> Result<TimeUnit, ArrowError>
fn parse_time_unit(&mut self, context: &str) -> Result<TimeUnit, ArrowError>
Parses the next timeunit
Sourcefn parse_double_quoted_string(
&mut self,
context: &str,
) -> Result<String, ArrowError>
fn parse_double_quoted_string( &mut self, context: &str, ) -> Result<String, ArrowError>
Parses the next double quoted string
Sourcefn parse_single_quoted_string(
&mut self,
context: &str,
) -> Result<String, ArrowError>
fn parse_single_quoted_string( &mut self, context: &str, ) -> Result<String, ArrowError>
Parses the next single quoted string
Sourcefn parse_i64(&mut self, context: &str) -> Result<i64, ArrowError>
fn parse_i64(&mut self, context: &str) -> Result<i64, ArrowError>
Parses the next integer value
Sourcefn parse_i32(&mut self, context: &str) -> Result<i32, ArrowError>
fn parse_i32(&mut self, context: &str) -> Result<i32, ArrowError>
Parses the next i32 integer value
Sourcefn parse_i8(&mut self, context: &str) -> Result<i8, ArrowError>
fn parse_i8(&mut self, context: &str) -> Result<i8, ArrowError>
Parses the next i8 integer value
Sourcefn parse_u8(&mut self, context: &str) -> Result<u8, ArrowError>
fn parse_u8(&mut self, context: &str) -> Result<u8, ArrowError>
Parses the next u8 integer value
Sourcefn parse_timestamp(&mut self) -> Result<DataType, ArrowError>
fn parse_timestamp(&mut self) -> Result<DataType, ArrowError>
Parses the next timestamp (called after Timestamp has been consumed)
Sourcefn parse_time32(&mut self) -> Result<DataType, ArrowError>
fn parse_time32(&mut self) -> Result<DataType, ArrowError>
Parses the next Time32 (called after Time32 has been consumed)
Sourcefn parse_time64(&mut self) -> Result<DataType, ArrowError>
fn parse_time64(&mut self) -> Result<DataType, ArrowError>
Parses the next Time64 (called after Time64 has been consumed)
Sourcefn parse_duration(&mut self) -> Result<DataType, ArrowError>
fn parse_duration(&mut self) -> Result<DataType, ArrowError>
Parses the next Duration (called after Duration has been consumed)
Sourcefn parse_interval(&mut self) -> Result<DataType, ArrowError>
fn parse_interval(&mut self) -> Result<DataType, ArrowError>
Parses the next Interval (called after Interval has been consumed)
Sourcefn parse_fixed_size_binary(&mut self) -> Result<DataType, ArrowError>
fn parse_fixed_size_binary(&mut self) -> Result<DataType, ArrowError>
Parses the next FixedSizeBinary (called after FixedSizeBinary has been consumed)
Sourcefn parse_decimal_32(&mut self) -> Result<DataType, ArrowError>
fn parse_decimal_32(&mut self) -> Result<DataType, ArrowError>
Parses the next Decimal32 (called after Decimal32 has been consumed)
Sourcefn parse_decimal_64(&mut self) -> Result<DataType, ArrowError>
fn parse_decimal_64(&mut self) -> Result<DataType, ArrowError>
Parses the next Decimal64 (called after Decimal64 has been consumed)
Sourcefn parse_decimal_128(&mut self) -> Result<DataType, ArrowError>
fn parse_decimal_128(&mut self) -> Result<DataType, ArrowError>
Parses the next Decimal128 (called after Decimal128 has been consumed)
Sourcefn parse_decimal_256(&mut self) -> Result<DataType, ArrowError>
fn parse_decimal_256(&mut self) -> Result<DataType, ArrowError>
Parses the next Decimal256 (called after Decimal256 has been consumed)
Sourcefn parse_dictionary(&mut self) -> Result<DataType, ArrowError>
fn parse_dictionary(&mut self) -> Result<DataType, ArrowError>
Parses the next Dictionary (called after Dictionary has been consumed)
Sourcefn parse_struct(&mut self) -> Result<DataType, ArrowError>
fn parse_struct(&mut self) -> Result<DataType, ArrowError>
Parses the next Struct (called after Struct has been consumed)
Sourcefn parse_union(&mut self) -> Result<DataType, ArrowError>
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))
Sourcefn parse_union_mode(&mut self) -> Result<UnionMode, ArrowError>
fn parse_union_mode(&mut self) -> Result<UnionMode, ArrowError>
Parses the next UnionMode
Sourcefn parse_union_field(&mut self) -> Result<(i8, Field), ArrowError>
fn parse_union_field(&mut self) -> Result<(i8, Field), ArrowError>
Parses the next UnionField 0: (“a”: non-null Int32)
Sourcefn parse_map(&mut self) -> Result<DataType, ArrowError>
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)
Sourcefn parse_map_sorted(&mut self) -> Result<bool, ArrowError>
fn parse_map_sorted(&mut self) -> Result<bool, ArrowError>
Parses map’s sorted
Sourcefn parse_run_end_encoded(&mut self) -> Result<DataType, ArrowError>
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)
Sourcefn parse_opt_nullable(&mut self) -> bool
fn parse_opt_nullable(&mut self) -> bool
consume the next token and return false if the field is nonnull.
Sourcefn next_token(&mut self) -> Result<Token, ArrowError>
fn next_token(&mut self) -> Result<Token, ArrowError>
return the next token, or an error if there are none left
Sourcefn expect_token(&mut self, tok: Token) -> Result<(), ArrowError>
fn expect_token(&mut self, tok: Token) -> Result<(), ArrowError>
consume the next token, returning OK(()) if it matches tok, and Err if not