Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
wForget committed Jan 23, 2025
1 parent e2c0178 commit 958476b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 3 additions & 7 deletions native/core/src/execution/metrics/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,21 @@
// under the License.

use crate::execution::spark_plan::SparkPlan;
use crate::{
errors::CometError,
jvm_bridge::jni_call,
};
use crate::{errors::CometError, jvm_bridge::jni_call};
use datafusion::physical_plan::metrics::MetricValue;
use datafusion_comet_proto::spark_metric::NativeMetricNode;
use jni::{objects::JObject, JNIEnv};
use prost::Message;
use std::collections::HashMap;
use std::sync::Arc;
use prost::Message;

/// Updates the metrics of a CometMetricNode. This function is called recursively to
/// update the metrics of all the children nodes. The metrics are pulled from the
/// native execution plan and pushed to the Java side through JNI.
pub fn update_comet_metric(
env: &mut JNIEnv,
metric_node: &JObject,
spark_plan: &Arc<SparkPlan>
spark_plan: &Arc<SparkPlan>,
) -> Result<(), CometError> {
unsafe {
let native_metric = to_native_metric_node(spark_plan);
Expand Down Expand Up @@ -77,7 +74,6 @@ pub fn to_native_metric_node(spark_plan: &Arc<SparkPlan>) -> Result<NativeMetric
native_metric_node.metrics.insert(name.to_string(), value);
});


// add children
spark_plan.children().iter().for_each(|child_plan| {
let child_node = to_native_metric_node(child_plan).unwrap();
Expand Down
6 changes: 5 additions & 1 deletion native/core/src/jvm_bridge/comet_metric_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ impl<'a> CometMetricNode<'a> {
method_get_child_node_ret: ReturnType::Object,
method_set: env.get_method_id(Self::JVM_CLASS, "set", "(Ljava/lang/String;J)V")?,
method_set_ret: ReturnType::Primitive(Primitive::Void),
method_set_all_from_bytes: env.get_method_id(Self::JVM_CLASS, "set_all_from_bytes", "([B)V")?,
method_set_all_from_bytes: env.get_method_id(
Self::JVM_CLASS,
"set_all_from_bytes",
"([B)V",
)?,
method_set_all_from_bytes_ret: ReturnType::Primitive(Primitive::Void),
class,
})
Expand Down

0 comments on commit 958476b

Please sign in to comment.