pub fn parse_data_type(val: &str) -> Result<DataType>
Expand description

Parses str into a DataType.

parse_data_type is the the reverse of DataType’s Display impl, and maintains the invariant that parse_data_type(data_type.to_string()) == data_type

Example:

let display_value = "Int32";

// "Int32" is the Display value of `DataType`
assert_eq!(display_value, &format!("{}", DataType::Int32));

// parse_data_type coverts "Int32" back to `DataType`:
let data_type = parse_data_type(display_value).unwrap();
assert_eq!(data_type, DataType::Int32);

Remove if added to arrow: https://github.com/apache/arrow-rs/issues/3821