@@ -11,7 +11,7 @@ use crate::{
11
11
utils:: immutable:: RefList ,
12
12
} ;
13
13
14
- use super :: memoization:: { EvaluationCache , MemoizationInfo } ;
14
+ use super :: memoization:: EvaluationCache ;
15
15
16
16
#[ derive( Debug ) ]
17
17
pub struct ScopeValueBuilder {
@@ -285,22 +285,19 @@ fn assemble_input_values(
285
285
. collect ( )
286
286
}
287
287
288
- struct CacheEntry {
289
- value : serde_json:: Value ,
290
- used : bool ,
291
- }
292
-
293
288
async fn evaluate_child_op_scope (
294
289
op_scope : & AnalyzedOpScope ,
295
290
scoped_entries : RefList < ' _ , & ScopeEntry < ' _ > > ,
296
291
child_scope_entry : ScopeEntry < ' _ > ,
292
+ cache : Option < & EvaluationCache > ,
297
293
) -> 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
299
295
}
300
296
301
297
async fn evaluate_op_scope (
302
298
op_scope : & AnalyzedOpScope ,
303
299
scoped_entries : RefList < ' _ , & ScopeEntry < ' _ > > ,
300
+ cache : Option < & EvaluationCache > ,
304
301
) -> Result < ( ) > {
305
302
let head_scope = * scoped_entries. head ( ) . unwrap ( ) ;
306
303
for reactive_op in op_scope. reactive_ops . iter ( ) {
@@ -331,6 +328,7 @@ async fn evaluate_op_scope(
331
328
value : & item,
332
329
schema : & collection_schema. row ,
333
330
} ,
331
+ cache,
334
332
)
335
333
} )
336
334
. collect :: < Vec < _ > > ( ) ,
@@ -345,6 +343,7 @@ async fn evaluate_op_scope(
345
343
value : v,
346
344
schema : & collection_schema. row ,
347
345
} ,
346
+ cache,
348
347
)
349
348
} )
350
349
. collect :: < Vec < _ > > ( ) ,
@@ -360,6 +359,7 @@ async fn evaluate_op_scope(
360
359
value : item,
361
360
schema : & collection_schema. row ,
362
361
} ,
362
+ cache,
363
363
)
364
364
} )
365
365
. collect :: < Vec < _ > > ( ) ,
@@ -395,8 +395,8 @@ pub async fn evaluate_source_entry<'a>(
395
395
source_op_idx : u32 ,
396
396
schema : & schema:: DataSchema ,
397
397
key : & value:: KeyValue ,
398
- memoization_info : Option < MemoizationInfo > ,
399
- ) -> Result < Option < ( ScopeValueBuilder , MemoizationInfo ) > > {
398
+ cache : Option < & EvaluationCache > ,
399
+ ) -> Result < Option < ScopeValueBuilder > > {
400
400
let root_schema = & schema. schema ;
401
401
let root_scope_value =
402
402
ScopeValueBuilder :: new ( root_schema. fields . len ( ) , schema. collectors . len ( ) ) ;
@@ -419,23 +419,20 @@ pub async fn evaluate_source_entry<'a>(
419
419
420
420
let result = match source_op. executor . get_value ( & key) . await ? {
421
421
Some ( val) => {
422
- let cache = memoization_info
423
- . map ( |info| EvaluationCache :: from_stored ( info. cache ) )
424
- . unwrap_or_default ( ) ;
425
422
let scope_value =
426
423
ScopeValueBuilder :: augmented_from ( value:: ScopeValue ( val) , & collection_schema) ?;
427
424
root_scope_entry. define_field_w_builder (
428
425
& source_op. output ,
429
426
value:: Value :: Table ( BTreeMap :: from ( [ ( key. clone ( ) , scope_value) ] ) ) ,
430
427
) ;
431
428
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 )
439
436
}
440
437
None => None ,
441
438
} ;
@@ -468,6 +465,7 @@ pub async fn evaluate_transient_flow(
468
465
evaluate_op_scope (
469
466
& flow. execution_plan . op_scope ,
470
467
RefList :: Nil . prepend ( & root_scope_entry) ,
468
+ None ,
471
469
)
472
470
. await ?;
473
471
let output_value = assemble_value (
0 commit comments