Skip to main content

parse_literal

pub fn parse_literal<T>(
    expr: &Expr,
) -> Result<<T as ArrowPrimitiveType>::Native, DataFusionError>
Expand description

Parse and simplifies an expression to a numeric literal, corresponding to an arrow primitive type T (for example, Float64Type).

This function simplifies and coerces the expression, then extracts the underlying native type using TryFrom<ScalarValue>.

§Example

let value: f64 = parse_literal::<Float64Type>(expr)?;