diff --git a/crates/polars-plan/src/logical_plan/builder.rs b/crates/polars-plan/src/logical_plan/builder.rs index 7bc50b97c076..6ccfd66afb93 100644 --- a/crates/polars-plan/src/logical_plan/builder.rs +++ b/crates/polars-plan/src/logical_plan/builder.rs @@ -401,7 +401,7 @@ impl LogicalPlanBuilder { pub fn drop_columns(self, to_drop: PlHashSet) -> Self { let schema = try_delayed!(self.0.schema(), &self.0, into); - let mut output_schema = Schema::with_capacity(schema.len() - to_drop.len()); + let mut output_schema = Schema::with_capacity(schema.len().saturating_sub(to_drop.len())); let columns = schema .iter() .filter_map(|(col_name, dtype)| {