wForget commented on code in PR #1329: URL: https://github.com/apache/datafusion-comet/pull/1329#discussion_r1943950610
########## native/core/src/execution/metrics/utils.rs: ########## @@ -55,60 +64,21 @@ pub fn update_comet_metric( Some(metrics.aggregate_by_name()) }; - update_metrics( - env, - metric_node, - &metrics - .unwrap_or_default() - .iter() - .map(|m| m.value()) - .map(|m| (m.name(), m.as_usize() as i64)) - .collect::<Vec<_>>(), - metrics_jstrings, - )?; + // add metrics + node_metrics + .unwrap_or_default() + .iter() + .map(|m| m.value()) + .map(|m| (m.name(), m.as_usize() as i64)) + .for_each(|(name, value)| { + native_metric_node.metrics.insert(name.to_string(), value); + }); - unsafe { - for (i, child_plan) in spark_plan.children().iter().enumerate() { - let child_metric_node: JObject = jni_call!(env, - comet_metric_node(metric_node).get_child_node(i as i32) -> JObject - )?; - if child_metric_node.is_null() { - continue; - } - update_comet_metric(env, &child_metric_node, child_plan, metrics_jstrings)?; - } - } - Ok(()) -} + // add children + spark_plan.children().iter().for_each(|child_plan| { + let child_node = to_native_metric_node(child_plan).unwrap(); + native_metric_node.children.push(child_node); + }); Review Comment: Thank you for your suggestion, changed. I am not familiar with rust yet, and I hope to learn rust by contributing to comet. :grin: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org