Skip to content

Commit

Permalink
use first series to validate length (#3551)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jun 1, 2022
1 parent de92284 commit 5b23e4e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion polars/polars-lazy/src/physical_plan/expressions/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl PhysicalExpr for ApplyExpr {
})
.collect::<Vec<_>>();

let input_len = s.iter().map(|s| s.len()).max().unwrap();
let input_len = s[0].len();
let s = self.function.call_udf(&mut s)?;
check_map_output_len(input_len, s.len())?;

Expand Down
15 changes: 15 additions & 0 deletions polars/tests/it/lazy/expressions/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,18 @@ fn test_window_naive_any() -> Result<()> {
assert_eq!(res.sum::<usize>(), Some(5));
Ok(())
}

#[test]
fn test_window_map_empty_df_3542() -> Result<()> {
let df = df![
"x" => ["a", "b", "c"],
"y" => [Some(1), None, Some(3)]
]?;
let out = df
.lazy()
.filter(col("y").lt(0))
.select([col("y").fill_null(0).last().over([col("y")])])
.collect()?;
assert_eq!(out.height(), 0);
Ok(())
}

0 comments on commit 5b23e4e

Please sign in to comment.