Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel panics when passing list(categorical) as input #54

Closed
ion-elgreco opened this issue Dec 19, 2023 · 0 comments · Fixed by pola-rs/polars#13325
Closed

Kernel panics when passing list(categorical) as input #54

ion-elgreco opened this issue Dec 19, 2023 · 0 comments · Fixed by pola-rs/polars#13325

Comments

@ion-elgreco
Copy link

ion-elgreco commented Dec 19, 2023

Passing a list(categorical) to a registered plugin expr will instantly kill the kernel:

Assume this simple expression

#[polars_expr(output_type=Float64)]
fn test(inputs: &[Series]) -> PolarsResult<Series> {
    Ok(Series::from_vec("TEST", vec![0.0]))
}

Then this plugin code:

@pl.api.register_expr_namespace("testing")
class TestSpace:
    def __init__(self, expr: pl.Expr):
        self._expr = expr

    def test(self) -> pl.Expr:
        """test"""
        return self._expr.register_plugin(
            lib=lib,
            symbol="test",
            is_elementwise=True,
        )

Now exucting this expression on list(categorical) will faill.

df = pl.DataFrame(
    {"x": [["1"]],},
    schema={"x": pl.List(pl.Categorical)},
)

df.with_columns(
    pl.col("x").testing.test(),
)

image

However this runs fine:

df = pl.DataFrame(
    {"x": [["1"]]},
    schema={"x": pl.List(pl.Utf8)},
)

df.with_columns(
    pl.col("x").dist_list.test(),
)
shape: (1, 1)
┌─────┐
│ x   │
│ --- │
│ f64 │
╞═════╡
│ 0.0 │
└─────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant