Skip to content

Commit

Permalink
lazy err on not found col (#3169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Apr 17, 2022
1 parent e2f2828 commit 0a14848
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ impl OptimizationRule for TypeCoercionRule {

let type_left = left
.get_type(input_schema, Context::Default, expr_arena)
.expect("could not get dtype");
.ok()?;
let type_right = right
.get_type(input_schema, Context::Default, expr_arena)
.expect("could not get dtype");
.ok()?;

#[allow(unused_mut, unused_assignments)]
let mut compare_cat_to_string = false;
Expand Down
14 changes: 14 additions & 0 deletions polars/tests/it/lazy/projection_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,17 @@ fn test_outer_join_with_column_2988() -> Result<()> {

Ok(())
}

#[test]
fn test_err_no_found() {
let df = df![
"a" => [1, 2, 3],
"b" => [None, Some("a"), Some("b")]
]
.unwrap();

assert!(matches!(
df.lazy().filter(col("nope").gt(lit(2))).collect(),
Err(PolarsError::NotFound(_))
));
}

0 comments on commit 0a14848

Please sign in to comment.