From 4d176e0ba7cedf4395e3ac59668e6d96fc1d7ebb Mon Sep 17 00:00:00 2001 From: Orson Peters Date: Mon, 9 Sep 2024 16:13:04 +0200 Subject: [PATCH] refactor(rust): Fix unimplemented panics to give todo!s for AUTO_NEW_STREAMING (#18628) --- crates/polars-lazy/src/frame/mod.rs | 4 +++- crates/polars-stream/src/physical_plan/lower_ir.rs | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/polars-lazy/src/frame/mod.rs b/crates/polars-lazy/src/frame/mod.rs index b2cfd7267025..d6fd3d4364cb 100644 --- a/crates/polars-lazy/src/frame/mod.rs +++ b/crates/polars-lazy/src/frame/mod.rs @@ -733,7 +733,9 @@ impl LazyFrame { // Fallback to normal engine if error is due to not being implemented // and auto_new_streaming is set, otherwise propagate error. if auto_new_streaming - && e.downcast_ref::<&str>() == Some(&"not yet implemented") + && e.downcast_ref::<&str>() + .map(|s| s.starts_with("not yet implemented")) + .unwrap_or(false) { if polars_core::config::verbose() { eprintln!("caught unimplemented error in new streaming engine, falling back to normal engine"); diff --git a/crates/polars-stream/src/physical_plan/lower_ir.rs b/crates/polars-stream/src/physical_plan/lower_ir.rs index 65044a717213..5a1e44694a99 100644 --- a/crates/polars-stream/src/physical_plan/lower_ir.rs +++ b/crates/polars-stream/src/physical_plan/lower_ir.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use polars_core::prelude::{InitHashMaps, PlHashMap, PlIndexMap}; use polars_core::schema::Schema; -use polars_error::{polars_err, PolarsResult}; +use polars_error::PolarsResult; use polars_plan::plans::expr_ir::{ExprIR, OutputName}; use polars_plan::plans::{AExpr, IR}; use polars_plan::prelude::SinkType; @@ -345,7 +345,7 @@ pub fn lower_ir( let paths = sources .into_paths() - .ok_or_else(|| polars_err!(nyi = "Streaming scanning of in-memory buffers"))?; + .unwrap_or_else(|| todo!("streaming scanning of in-memory buffers")); PhysNodeKind::FileScan { paths, @@ -358,7 +358,14 @@ pub fn lower_ir( } }, - _ => todo!(), + IR::PythonScan { .. } => todo!(), + IR::Reduce { .. } => todo!(), + IR::Cache { .. } => todo!(), + IR::GroupBy { .. } => todo!(), + IR::Join { .. } => todo!(), + IR::Distinct { .. } => todo!(), + IR::ExtContext { .. } => todo!(), + IR::Invalid => unreachable!(), }; Ok(phys_sm.insert(PhysNode::new(output_schema, node_kind)))