@@ -11,7 +11,7 @@ use crate::{
1111 utils:: immutable:: RefList ,
1212} ;
1313
14- use super :: memoization:: { EvaluationCache , MemoizationInfo } ;
14+ use super :: memoization:: EvaluationCache ;
1515
1616#[ derive( Debug ) ]
1717pub struct ScopeValueBuilder {
@@ -285,22 +285,19 @@ fn assemble_input_values(
285285 . collect ( )
286286}
287287
288- struct CacheEntry {
289- value : serde_json:: Value ,
290- used : bool ,
291- }
292-
293288async fn evaluate_child_op_scope (
294289 op_scope : & AnalyzedOpScope ,
295290 scoped_entries : RefList < ' _ , & ScopeEntry < ' _ > > ,
296291 child_scope_entry : ScopeEntry < ' _ > ,
292+ cache : Option < & EvaluationCache > ,
297293) -> Result < ( ) > {
298- evaluate_op_scope ( op_scope, scoped_entries. prepend ( & child_scope_entry) ) . await
294+ evaluate_op_scope ( op_scope, scoped_entries. prepend ( & child_scope_entry) , cache ) . await
299295}
300296
301297async fn evaluate_op_scope (
302298 op_scope : & AnalyzedOpScope ,
303299 scoped_entries : RefList < ' _ , & ScopeEntry < ' _ > > ,
300+ cache : Option < & EvaluationCache > ,
304301) -> Result < ( ) > {
305302 let head_scope = * scoped_entries. head ( ) . unwrap ( ) ;
306303 for reactive_op in op_scope. reactive_ops . iter ( ) {
@@ -331,6 +328,7 @@ async fn evaluate_op_scope(
331328 value : & item,
332329 schema : & collection_schema. row ,
333330 } ,
331+ cache,
334332 )
335333 } )
336334 . collect :: < Vec < _ > > ( ) ,
@@ -345,6 +343,7 @@ async fn evaluate_op_scope(
345343 value : v,
346344 schema : & collection_schema. row ,
347345 } ,
346+ cache,
348347 )
349348 } )
350349 . collect :: < Vec < _ > > ( ) ,
@@ -360,6 +359,7 @@ async fn evaluate_op_scope(
360359 value : item,
361360 schema : & collection_schema. row ,
362361 } ,
362+ cache,
363363 )
364364 } )
365365 . collect :: < Vec < _ > > ( ) ,
@@ -395,8 +395,8 @@ pub async fn evaluate_source_entry<'a>(
395395 source_op_idx : u32 ,
396396 schema : & schema:: DataSchema ,
397397 key : & value:: KeyValue ,
398- memoization_info : Option < MemoizationInfo > ,
399- ) -> Result < Option < ( ScopeValueBuilder , MemoizationInfo ) > > {
398+ cache : Option < & EvaluationCache > ,
399+ ) -> Result < Option < ScopeValueBuilder > > {
400400 let root_schema = & schema. schema ;
401401 let root_scope_value =
402402 ScopeValueBuilder :: new ( root_schema. fields . len ( ) , schema. collectors . len ( ) ) ;
@@ -419,23 +419,20 @@ pub async fn evaluate_source_entry<'a>(
419419
420420 let result = match source_op. executor . get_value ( & key) . await ? {
421421 Some ( val) => {
422- let cache = memoization_info
423- . map ( |info| EvaluationCache :: from_stored ( info. cache ) )
424- . unwrap_or_default ( ) ;
425422 let scope_value =
426423 ScopeValueBuilder :: augmented_from ( value:: ScopeValue ( val) , & collection_schema) ?;
427424 root_scope_entry. define_field_w_builder (
428425 & source_op. output ,
429426 value:: Value :: Table ( BTreeMap :: from ( [ ( key. clone ( ) , scope_value) ] ) ) ,
430427 ) ;
431428
432- evaluate_op_scope ( & plan . op_scope , RefList :: Nil . prepend ( & root_scope_entry ) ) . await ? ;
433- Some ( (
434- root_scope_value ,
435- MemoizationInfo {
436- cache : cache . into_stored ( ) ? ,
437- } ,
438- ) )
429+ evaluate_op_scope (
430+ & plan . op_scope ,
431+ RefList :: Nil . prepend ( & root_scope_entry ) ,
432+ cache ,
433+ )
434+ . await ? ;
435+ Some ( root_scope_value )
439436 }
440437 None => None ,
441438 } ;
@@ -468,6 +465,7 @@ pub async fn evaluate_transient_flow(
468465 evaluate_op_scope (
469466 & flow. execution_plan . op_scope ,
470467 RefList :: Nil . prepend ( & root_scope_entry) ,
468+ None ,
471469 )
472470 . await ?;
473471 let output_value = assemble_value (
0 commit comments