From ebcb42d4886c0ada7d2e2fade6986fe64b6c7651 Mon Sep 17 00:00:00 2001 From: Nick Lanham Date: Wed, 18 Dec 2024 16:45:55 -0800 Subject: [PATCH] Actually use ExpressionRef --- kernel/src/scan/log_replay.rs | 12 +++++++----- kernel/src/scan/mod.rs | 6 +++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/kernel/src/scan/log_replay.rs b/kernel/src/scan/log_replay.rs index 544e95f7c..df5ff73fd 100644 --- a/kernel/src/scan/log_replay.rs +++ b/kernel/src/scan/log_replay.rs @@ -47,7 +47,7 @@ struct AddRemoveDedupVisitor<'seen> { selection_vector: Vec, logical_schema: SchemaRef, transform: Option>, - transforms: HashMap, + transforms: HashMap, is_log_batch: bool, } @@ -132,7 +132,8 @@ impl AddRemoveDedupVisitor<'_> { TransformExpr::Static(field_expr) => Ok(field_expr.clone()), }) .try_collect()?; - self.transforms.insert(i, Expression::Struct(transforms)); + self.transforms + .insert(i, Arc::new(Expression::Struct(transforms))); } } Ok(!have_seen && is_add) @@ -315,10 +316,11 @@ mod tests { }, Scan, }; + use crate::Expression; use crate::{ engine::sync::SyncEngine, schema::{DataType, SchemaRef, StructField, StructType}, - Expression, + ExpressionRef, }; use super::scan_action_iter; @@ -403,9 +405,9 @@ mod tests { None, ); - fn validate_transform(transform: Option<&Expression>, expected_date_offset: i32) { + fn validate_transform(transform: Option<&ExpressionRef>, expected_date_offset: i32) { assert!(transform.is_some()); - if let Expression::Struct(inner) = transform.unwrap() { + if let Expression::Struct(inner) = transform.unwrap().as_ref() { if let Expression::Column(ref name) = inner[0] { assert_eq!(name, &column_name!("value"), "First col should be 'value'"); } else { diff --git a/kernel/src/scan/mod.rs b/kernel/src/scan/mod.rs index 0f5a1b7f0..bddbce9e5 100644 --- a/kernel/src/scan/mod.rs +++ b/kernel/src/scan/mod.rs @@ -348,7 +348,11 @@ pub(crate) enum TransformExpr { // TODO(nick): Make this a struct in a follow-on PR // (data, deletion_vec, transforms) -pub type ScanData = (Box, Vec, HashMap); +pub type ScanData = ( + Box, + Vec, + HashMap, +); /// The result of building a scan over a table. This can be used to get the actual data from /// scanning the table.