From 134d43edeb5d462a77b8d6475ea7746a44656342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Havelund=20Welling?= Date: Fri, 14 Jul 2023 20:28:42 +0200 Subject: [PATCH] feat(rust): access `OptState` in `LazyFrame` to unit-test optimization toggle methods. (#9883) --- polars/polars-lazy/polars-plan/src/frame/opt_state.rs | 2 +- polars/polars-lazy/src/frame/mod.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/polars/polars-lazy/polars-plan/src/frame/opt_state.rs b/polars/polars-lazy/polars-plan/src/frame/opt_state.rs index f99ae1f4f8b8..28cf448c76f9 100644 --- a/polars/polars-lazy/polars-plan/src/frame/opt_state.rs +++ b/polars/polars-lazy/polars-plan/src/frame/opt_state.rs @@ -1,4 +1,4 @@ -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] /// State of the allowed optimizations pub struct OptState { pub projection_pushdown: bool, diff --git a/polars/polars-lazy/src/frame/mod.rs b/polars/polars-lazy/src/frame/mod.rs index 593333c96f82..ed3641d0b001 100644 --- a/polars/polars-lazy/src/frame/mod.rs +++ b/polars/polars-lazy/src/frame/mod.rs @@ -110,6 +110,11 @@ impl LazyFrame { } } + /// Get current optimizations + pub fn get_current_optimizations(&self) -> OptState { + self.opt_state + } + /// Set allowed optimizations pub fn with_optimizations(mut self, opt_state: OptState) -> Self { self.opt_state = opt_state;