From 00650b9b2d6ff4cf6715d3c58c53db9fdced1ca0 Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Fri, 18 Oct 2024 14:23:50 +0200 Subject: [PATCH] fix: Error on invalid query (#19303) --- crates/polars-lazy/src/physical_plan/exotic.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/polars-lazy/src/physical_plan/exotic.rs b/crates/polars-lazy/src/physical_plan/exotic.rs index e3c2b9e58120..2bbbc73b6948 100644 --- a/crates/polars-lazy/src/physical_plan/exotic.rs +++ b/crates/polars-lazy/src/physical_plan/exotic.rs @@ -33,7 +33,10 @@ pub(crate) fn prepare_expression_for_context( let schema = lf.collect_schema()?; let optimized = lf.optimize(&mut lp_arena, &mut expr_arena)?; let lp = lp_arena.get(optimized); - let aexpr = lp.get_exprs().pop().unwrap(); + let aexpr = lp + .get_exprs() + .pop() + .ok_or_else(|| polars_err!(ComputeError: "expected expressions in the context"))?; create_physical_expr( &aexpr,