@@ -446,30 +446,34 @@ async fn evaluate_op_scope(
446446 Ok ( ( ) )
447447}
448448
449+ pub struct SourceRowEvaluationContext < ' a > {
450+ pub plan : & ' a ExecutionPlan ,
451+ pub import_op : & ' a AnalyzedImportOp ,
452+ pub schema : & ' a schema:: FlowSchema ,
453+ pub key : & ' a value:: KeyValue ,
454+ }
455+
449456#[ derive( Debug ) ]
450457pub struct EvaluateSourceEntryOutput {
451458 pub data_scope : ScopeValueBuilder ,
452459 pub collected_values : Vec < Vec < value:: FieldValues > > ,
453460}
454461
455462pub async fn evaluate_source_entry (
456- plan : & ExecutionPlan ,
457- import_op : & AnalyzedImportOp ,
458- schema : & schema:: FlowSchema ,
459- key : & value:: KeyValue ,
463+ src_eval_ctx : & SourceRowEvaluationContext < ' _ > ,
460464 source_value : value:: FieldValues ,
461465 memory : & EvaluationMemory ,
462466) -> Result < EvaluateSourceEntryOutput > {
463- let root_schema = & schema. schema ;
467+ let root_schema = & src_eval_ctx . schema . schema ;
464468 let root_scope_value = ScopeValueBuilder :: new ( root_schema. fields . len ( ) ) ;
465469 let root_scope_entry = ScopeEntry :: new (
466470 ScopeKey :: None ,
467471 & root_scope_value,
468472 root_schema,
469- & plan. op_scope ,
473+ & src_eval_ctx . plan . op_scope ,
470474 ) ;
471475
472- let table_schema = match & root_schema. fields [ import_op. output . field_idx as usize ]
476+ let table_schema = match & root_schema. fields [ src_eval_ctx . import_op . output . field_idx as usize ]
473477 . value_type
474478 . typ
475479 {
@@ -482,12 +486,12 @@ pub async fn evaluate_source_entry(
482486 let scope_value =
483487 ScopeValueBuilder :: augmented_from ( & value:: ScopeValue ( source_value) , table_schema) ?;
484488 root_scope_entry. define_field_w_builder (
485- & import_op. output ,
486- value:: Value :: KTable ( BTreeMap :: from ( [ ( key. clone ( ) , scope_value) ] ) ) ,
489+ & src_eval_ctx . import_op . output ,
490+ value:: Value :: KTable ( BTreeMap :: from ( [ ( src_eval_ctx . key . clone ( ) , scope_value) ] ) ) ,
487491 ) ;
488492
489493 evaluate_op_scope (
490- & plan. op_scope ,
494+ & src_eval_ctx . plan . op_scope ,
491495 RefList :: Nil . prepend ( & root_scope_entry) ,
492496 memory,
493497 )
0 commit comments