Expand description
Parser implementations for converting strings to Arrow types
Used by the CSV and JSON readers to convert strings to Arrow types
MacrosΒ§
- parser_
primitive π
StructsΒ§
- Decimal
Accumulator π - Accumulates decimal digits into
chunk, folding it intovaluewhenever it reachesMAX_CHUNK_DIGITSdigits - Interval π
- Interval
Amount π - Interval
Parse Config - Config to parse interval strings
- Timestamp
Parser π - Helper for parsing RFC3339 timestamps
EnumsΒ§
- Decimal
Parse πError - The reason a decimal string could not be parsed.
- Interval
Unit - Represents the units of an interval, with each variant corresponding to a bit in the intervalβs bitfield representation
- Mantissa
Error π - Why scanning the digits of a decimal string stopped.
ConstantsΒ§
- EPOCH_
DAYS_ πFROM_ CE - Number of days between 0001-01-01 and 1970-01-01
- ERR_
NANOSECONDS_ πNOT_ SUPPORTED - Error message if nanosecond conversion request beyond supported interval
- INTERVAL_
PRECISION π - Chosen based on the number of decimal digits in 1 week in nanoseconds
- MAX_
CHUNK_ πDIGITS - The maximum number of decimal digits accumulated in a
u64before the chunk is folded into the native value: every 18-digit number fits in au64, and splits into two halves that each fit in au32(seedecimal_chunk_to_native). - NANOS_
PER_ πHOUR - NANOS_
PER_ πMILLIS - NANOS_
PER_ πMINUTE - NANOS_
PER_ πSECOND
TraitsΒ§
- Parser
- Specialized parsing implementations to convert strings to Arrow types.
FunctionsΒ§
- decimal_
chunk_ πto_ native - Converts a chunk of at most
MAX_CHUNK_DIGITSdigits to the native type, negated ifnegative. - decimal_
pow π - Returns
10^expas aT::Native, or an overflow error if the result does not fit in the native type. - fold_
decimal_ πchunk - Folds a chunk of up to
MAX_CHUNK_DIGITSdigits intovalue, producingvalue * 10^chunk_len + chunk(chunkis negated first when parsing a negative number). - not_
interval_ πamount - test if a character is NOT part of an interval numeric amount
- parse_
date π - parse_
date_ πto_ days - Parse a date string into days since 1970-01-01, covering the full
Date32range (years β Β±5,881,580) for the signed extended-year form. - parse_
decimal - Parses the string representation of a decimal number into the unscaled
native value of a decimal type with the given
precisionandscale. - parse_
decimal_ πchecked - Like
parse_decimal, but reports failures as aDecimalParseErrorinstead of formatting an error message, for callers that discard or re-wrap the error. - parse_
decimal_ πexponent - Parses the digits of an exponent (
[+|-] digits), saturating at the bounds ofi64; any exponent that large scales every non-zero mantissa out of range of every decimal type. - parse_
decimal_ πmantissa - Scans
mantissa(digits with at most one decimal point; the sign has already been removed) and folds the digits that are significant atscaleinto a native value, rounding half away from zero on the first digit that is not. Also returns an upper bound on the number of decimal digits of the value: the digits kept, the zeros appended to reach the scale, and the digit that rounding up can add. - parse_
decimal_ πnative - Parses
sas a decimal with the givenscaleinto the native type ofT, checking only that the result fits the native type (not the precision), and returns it with an upper bound on its number of decimal digits. - parse_
extended_ πymd - Parse the ISO 8601 signed extended-year form (
Β±YYYY[Y...]-MM-DD) into raw(year, month, day)components, without validating the calendar date. - parse_
interval_ πcomponents - parse the string into a vector of interval components i.e. (amount, unit) tuples
- parse_
interval_ day_ time - Parse human-readable interval string to Arrow [IntervalDayTimeType]
- parse_
interval_ month_ day_ nano - Parse human-readable interval string to Arrow [IntervalMonthDayNanoType]
- parse_
interval_ month_ day_ nano_ config - Parse human-readable interval string to Arrow [IntervalMonthDayNanoType]
- parse_
interval_ year_ month - Parse human-readable interval string to Arrow [IntervalYearMonthType]
- parse_
nanos π - Parse nanoseconds from the first
Nvalues in digits, subtracting the offsetO - split_
interval_ πcomponents - Split an interval into a vec of amounts and units.
- split_
sign π - Splits an optional leading sign from
bytes, returning whether it is-and the bytes that follow it. - string_
to_ datetime - Accepts a string and parses it relative to the provided
timezone - string_
to_ πtime - string_
to_ time_ nanoseconds - Accepts a string in ISO8601 standard format and some variants and converts it to nanoseconds since midnight.
- string_
to_ timestamp_ nanos - Accepts a string in RFC3339 / ISO8601 standard format and some variants and converts it to a nanosecond precision timestamp.
- to_
timestamp_ πnanos - Fallible conversion of
NaiveDateTimetoi64nanoseconds - trim_
pre_ πand_ post_ whitespace - this is a no-op if the string starts and ends with a digit, otherwise it will trim whitespace from the start and end of the string.
Type AliasesΒ§
- Month
DayNano - A tuple representing (months, days, nanoseconds) in an interval