pola-rs / pyo3-polars

Plugins/extension for Polars
MIT License
259 stars 42 forks source link

Compilation error when performant feature is enabled for polars #98

Closed lukeshingles closed 2 months ago

lukeshingles commented 2 months ago

When the "performant" feature of polars is enabled, compiling a project with pyo3-polars 0.16.0 gives the following compilation error with rustc 1.80.1:

   Compiling pyo3-polars v0.16.0
error[E0004]: non-exhaustive patterns: `&DataType::Struct(_)` not covered
   --> /Users/luke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-polars-0.16.0/src/types.rs:357:15
    |
357 |         match &self.0 {
    |               ^^^^^^^ pattern `&DataType::Struct(_)` not covered
    |
note: `DataType` defined here
   --> /Users/luke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-core-0.42.0/src/datatypes/dtype.rs:44:1
    |
44  | pub enum DataType {
    | ^^^^^^^^^^^^^^^^^
...
92  |     Struct(Vec<Field>),
    |     ------ not covered
    = note: the matched value is of type `&DataType`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
492 ~             },
493 +             &DataType::Struct(_) => todo!()
    |

For more information about this error, try `rustc --explain E0004`.

cargo.toml

[dependencies]
polars = { version = "0.42", features = ["diagonal_concat", "performant"] }
pyo3 = { version = "0.22", features = ["abi3-py310"] }
pyo3-polars = "0.16"
rayon = "1.10"

This error does not occur when pyo3-polars 0.15, polars 0.41, pyo3 0.21 are used, or when the performant feature is removed.

erichutchins commented 2 months ago

Adding "dtype-struct" feature yields the same error in my plugin project

[dependencies]
pyo3 = { version = "0.22.2", features = ["extension-module", "abi3-py38"] }
pyo3-polars = { version = "0.16.0", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
polars = { version = "0.42.0", features = [
    "dtype-struct",
], default-features = false }
lukeshingles commented 2 months ago

Adding "dtype-struct" feature yields the same error in my plugin project

The solution seems to be to add the dtype-struct feature to pyo3-polars, but this currently causes a compilation error. I've fixed that in PR #99.