Skip to content

Commit

Permalink
Fix compilation errors for features: dtype-struct and dtype-full
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Aug 15, 2024
1 parent a2a31be commit 0515a92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyo3-polars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ thiserror = "1"
[features]
lazy = ["polars/serde-lazy", "polars-plan", "polars-lazy/serde", "ciborium"]
derive = ["pyo3-polars-derive", "polars-plan", "polars-ffi", "serde-pickle", "serde"]
dtype-full = ["polars/dtype-full", "dtype-decimal", "dtype-array", "dtype-categorical"]
dtype-full = ["polars/dtype-full", "dtype-decimal", "dtype-array", "dtype-struct", "dtype-categorical"]
object = ["polars/object"]
dtype-decimal = ["polars/dtype-decimal"]
dtype-struct = ["polars/dtype-struct"]
Expand Down
8 changes: 5 additions & 3 deletions pyo3-polars/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use pyo3::intern;
use pyo3::prelude::*;
use pyo3::pybacked::PyBackedStr;
use pyo3::types::PyDict;
#[cfg(feature = "dtype-full")]
#[cfg(feature = "dtype-struct")]
use pyo3::types::PyList;

#[cfg(feature = "dtype-categorical")]
Expand Down Expand Up @@ -460,7 +460,7 @@ impl ToPyObject for PyDataType {
let categories = rev_map.as_ref().unwrap().get_categories();
let class = pl.getattr(intern!(py, "Enum")).unwrap();
let s = Series::from_arrow("category", categories.clone().boxed()).unwrap();
let series = to_series(py, s.into());
let series = to_series(py, PySeries(s));
return class.call1((series,)).unwrap().into();
}
DataType::Time => pl.getattr(intern!(py, "Time")).unwrap().into(),
Expand Down Expand Up @@ -577,7 +577,9 @@ impl<'py> FromPyObject<'py> for PyDataType {
let ordering = match ordering.extract::<&str>()? {
"physical" => CategoricalOrdering::Physical,
"lexical" => CategoricalOrdering::Lexical,
ordering => PyValueError::new_err(format!("invalid ordering argument: {ordering}"))
ordering => {
return Err(PyValueError::new_err(format!("invalid ordering argument: {ordering}")))
}
};

DataType::Categorical(None, ordering)
Expand Down

0 comments on commit 0515a92

Please sign in to comment.