Skip to content

Commit

Permalink
fix: Materialize dtypes when converting to arrow (#16074)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored May 6, 2024
1 parent 421db23 commit 3600b16
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/polars-core/src/datatypes/dtype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::collections::BTreeMap;
use super::*;
#[cfg(feature = "object")]
use crate::chunked_array::object::registry::ObjectRegistry;
use crate::utils::materialize_dyn_int;

pub type TimeZone = String;

Expand Down Expand Up @@ -544,7 +545,17 @@ impl DataType {
Ok(ArrowDataType::Struct(fields))
},
BinaryOffset => Ok(ArrowDataType::LargeBinary),
Unknown(_) => Ok(ArrowDataType::Unknown),
Unknown(kind) => {
let dt = match kind {
UnknownKind::Any => ArrowDataType::Unknown,
UnknownKind::Float => ArrowDataType::Float64,
UnknownKind::Str => ArrowDataType::Utf8View,
UnknownKind::Int(v) => {
return materialize_dyn_int(*v).dtype().try_to_arrow(pl_flavor)
},
};
Ok(dt)
},
}
}

Expand Down

0 comments on commit 3600b16

Please sign in to comment.