@@ -153,11 +153,7 @@ pub fn stage_metrics_rewriter(
153153 let mut stage_metrics = MetricsSetProto :: new ( ) ;
154154
155155 for idx in 0 ..stage. tasks . len ( ) {
156- let stage_key = StageKey {
157- query_id : Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) ,
158- stage_id : stage. num as u64 ,
159- task_number : idx as u64 ,
160- } ;
156+ let stage_key = StageKey :: new ( Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) , stage. num as u64 , idx as u64 ) ;
161157 match metrics_collection. get ( & stage_key) {
162158 Some ( task_metrics) => {
163159 if node_idx >= task_metrics. len ( ) {
@@ -353,11 +349,11 @@ mod tests {
353349 // Generate metrics for each task and store them in the map.
354350 let mut metrics_collection = HashMap :: new ( ) ;
355351 for task_id in 0 ..stage. tasks . len ( ) {
356- let stage_key = StageKey {
357- query_id : Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) ,
358- stage_id : stage. num as u64 ,
359- task_number : task_id as u64 ,
360- } ;
352+ let stage_key = StageKey :: new (
353+ Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) ,
354+ stage. num as u64 ,
355+ task_id as u64 ,
356+ ) ;
361357 let metrics = ( 0 ..count_plan_nodes ( & plan) )
362358 . map ( |node_id| {
363359 make_test_metrics_set_proto_from_seed (
@@ -390,11 +386,11 @@ mod tests {
390386 . enumerate ( )
391387 {
392388 let expected_task_node_metrics = metrics_collection
393- . get ( & StageKey {
394- query_id : Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) ,
395- stage_id : stage. num as u64 ,
396- task_number : task_id as u64 ,
397- } )
389+ . get ( & StageKey :: new (
390+ Bytes :: from ( stage. query_id . as_bytes ( ) . to_vec ( ) ) ,
391+ stage. num as u64 ,
392+ task_id as u64 ,
393+ ) )
398394 . unwrap ( ) [ node_id]
399395 . clone ( ) ;
400396
0 commit comments