@@ -13,8 +13,8 @@ use utils::immutable::RefList;
1313
1414use super :: memoization:: { EvaluationMemory , EvaluationMemoryOptions , evaluate_with_cell} ;
1515
16- const TIMEOUT_THRESHOLD : u64 = 1800 ;
17- const WARNING_THRESHOLD : u64 = 30 ;
16+ const TIMEOUT_THRESHOLD : Duration = Duration :: from_secs ( 1800 ) ;
17+ const WARNING_THRESHOLD : Duration = Duration :: from_secs ( 30 ) ;
1818
1919#[ derive( Debug ) ]
2020pub struct ScopeValueBuilder {
@@ -390,7 +390,7 @@ where
390390 _ = tokio:: time:: sleep( warn_duration) , if !warned => {
391391 warn!(
392392 "Function '{}' ({}) is taking longer than {}s" ,
393- op_kind, op_name, WARNING_THRESHOLD
393+ op_kind, op_name, WARNING_THRESHOLD . as_secs ( )
394394 ) ;
395395 warned = true ;
396396 }
@@ -408,21 +408,20 @@ async fn evaluate_op_scope(
408408 for reactive_op in op_scope. reactive_ops . iter ( ) {
409409 match reactive_op {
410410 AnalyzedReactiveOp :: Transform ( op) => {
411- let transform_key = format ! ( "transform/{}{}" , op_scope. scope_qualifier, op. name) ;
412-
411+ // Track transform operation start
413412 if let Some ( ref op_stats) = operation_in_process_stats {
413+ let transform_key =
414+ format ! ( "transform/{}{}" , op_scope. scope_qualifier, op. name) ;
414415 op_stats. start_processing ( & transform_key, 1 ) ;
415416 }
416417
417418 let mut input_values = Vec :: with_capacity ( op. inputs . len ( ) ) ;
418419 for value in assemble_input_values ( & op. inputs , scoped_entries) {
419420 input_values. push ( value?) ;
420421 }
421- let timeout_duration = op
422- . function_exec_info
423- . timeout
424- . unwrap_or ( Duration :: from_secs ( TIMEOUT_THRESHOLD ) ) ;
425- let warn_duration = Duration :: from_secs ( WARNING_THRESHOLD ) ;
422+
423+ let timeout_duration = op. function_exec_info . timeout . unwrap_or ( TIMEOUT_THRESHOLD ) ;
424+ let warn_duration = WARNING_THRESHOLD ;
426425
427426 let op_name_for_warning = op. name . clone ( ) ;
428427 let op_kind_for_warning = op. op_kind . clone ( ) ;
@@ -468,7 +467,10 @@ async fn evaluate_op_scope(
468467 head_scope. define_field ( & op. output , & v)
469468 } ;
470469
470+ // Track transform operation completion
471471 if let Some ( ref op_stats) = operation_in_process_stats {
472+ let transform_key =
473+ format ! ( "transform/{}{}" , op_scope. scope_qualifier, op. name) ;
472474 op_stats. finish_processing ( & transform_key, 1 ) ;
473475 }
474476
@@ -574,6 +576,43 @@ async fn evaluate_op_scope(
574576 let collector_entry = scoped_entries
575577 . headn ( op. collector_ref . scope_up_level as usize )
576578 . ok_or_else ( || anyhow:: anyhow!( "Collector level out of bound" ) ) ?;
579+
580+ // Assemble input values
581+ let input_values: Vec < value:: Value > =
582+ assemble_input_values ( & op. input . fields , scoped_entries)
583+ . collect :: < Result < Vec < _ > > > ( ) ?;
584+
585+ // Create field_values vector for all fields in the merged schema
586+ let mut field_values = op
587+ . field_index_mapping
588+ . iter ( )
589+ . map ( |idx| {
590+ idx. map_or ( value:: Value :: Null , |input_idx| {
591+ input_values[ input_idx] . clone ( )
592+ } )
593+ } )
594+ . collect :: < Vec < _ > > ( ) ;
595+
596+ // Handle auto_uuid_field (assumed to be at position 0 for efficiency)
597+ if op. has_auto_uuid_field {
598+ if let Some ( uuid_idx) = op. collector_schema . auto_uuid_field_idx {
599+ let uuid = memory. next_uuid (
600+ op. fingerprinter
601+ . clone ( )
602+ . with (
603+ & field_values
604+ . iter ( )
605+ . enumerate ( )
606+ . filter ( |( i, _) | * i != uuid_idx)
607+ . map ( |( _, v) | v)
608+ . collect :: < Vec < _ > > ( ) ,
609+ ) ?
610+ . into_fingerprint ( ) ,
611+ ) ?;
612+ field_values[ uuid_idx] = value:: Value :: Basic ( value:: BasicValue :: Uuid ( uuid) ) ;
613+ }
614+ }
615+
577616 {
578617 let mut collected_records = collector_entry. collected_values
579618 [ op. collector_ref . local . collector_idx as usize ]
0 commit comments