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

Internal unwrap on Err(NotFound(Owned("val"))) #5070

Closed
2 tasks done
TheDan64 opened this issue Oct 1, 2022 · 0 comments · Fixed by #5071
Closed
2 tasks done

Internal unwrap on Err(NotFound(Owned("val"))) #5070

TheDan64 opened this issue Oct 1, 2022 · 0 comments · Fixed by #5071
Labels
bug Something isn't working rust Related to Rust Polars

Comments

@TheDan64
Copy link
Contributor

TheDan64 commented Oct 1, 2022

Polars version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Issue description

Previously working code in 0.23 but now breaks at runtime - a "not found" panic appears even though the column exists (printed out the column mid way to confirm). Appears to be at least in part related to both of the .select calls, removing either successfully runs again (though not in the intended way).

Reproducible example

fn lazy(lf: LazyFrame, column_name: &str, output_col_name: &str) -> LazyFrame {
    let diff = col("max").alias("diff");
    let result = col("val").div(col("diff")).alias(output_col_name);

    lf.with_columns(&[col(column_name).max().alias("max")])
        .with_column(diff)
        .with_column(result)
        .select(&[col("*").exclude(&["max", "diff"])])
}

let start_time = NaiveTime::from_hms(18, 29, 59);
let date = chrono::NaiveDate::parse_from_str("04-21-2022", "%m-%d-%Y")?;
let df = polars::df! {
    "date" => [
        NaiveDateTime::parse_from_str("2022-04-21 18:25:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:30:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:35:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:40:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:45:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:50:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 18:55:59", "%Y-%m-%d %H:%M:%S")?,
        NaiveDateTime::parse_from_str("2022-04-21 19:00:59", "%Y-%m-%d %H:%M:%S")?,
    ],
    "val" => [9.399994, 8.880005, 8.070007, 8.440002, 7.910004, 7.850006, 7.979996, 8.080002],
}?;

let filter = df
    .lazy()
    .filter(col("date").gt(lit(NaiveDateTime::new(date, start_time))))
    .select([col("*")]);
lazy(filter, "val", "output").collect()?;
thread 'test_bug' panicked at 'called `Result::unwrap()` on an `Err` value: NotFound(Owned("val"))', C:\Users\dan\.cargo\git\checkouts\polars-b0d90607192fd414\1a17950\polars\polars-lazy\polars-plan\src\logical_plan\alp.rs:723:18

Expected behavior

Expected that the code doesn't panic - this worked previously in 0.23

Installed versions

"avx512", "dtype-slim", "fmt", "lazy", "object", "performant", "random", "temporal",
@TheDan64 TheDan64 added bug Something isn't working rust Related to Rust Polars labels Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rust Related to Rust Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant