This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new e98ca3cd minor: rename CometMetricNode add to set and update
documentation (#940)
e98ca3cd is described below
commit e98ca3cdcbf2871ee9419bc8554de457811eeba0
Author: Andy Grove <[email protected]>
AuthorDate: Mon Sep 16 07:24:58 2024 -0600
minor: rename CometMetricNode add to set and update documentation (#940)
---
native/core/src/execution/metrics/utils.rs | 2 +-
native/core/src/jvm_bridge/comet_metric_node.rs | 8 ++++----
.../main/scala/org/apache/spark/sql/comet/CometMetricNode.scala | 9 +++++----
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/native/core/src/execution/metrics/utils.rs
b/native/core/src/execution/metrics/utils.rs
index 6990aa54..d759f6a8 100644
--- a/native/core/src/execution/metrics/utils.rs
+++ b/native/core/src/execution/metrics/utils.rs
@@ -66,7 +66,7 @@ fn update_metrics(
unsafe {
for &(name, value) in metric_values {
let jname = jni_new_string!(env, &name)?;
- jni_call!(env, comet_metric_node(metric_node).add(&jname, value)
-> ())?;
+ jni_call!(env, comet_metric_node(metric_node).set(&jname, value)
-> ())?;
}
}
Ok(())
diff --git a/native/core/src/jvm_bridge/comet_metric_node.rs
b/native/core/src/jvm_bridge/comet_metric_node.rs
index 55423a68..8647e071 100644
--- a/native/core/src/jvm_bridge/comet_metric_node.rs
+++ b/native/core/src/jvm_bridge/comet_metric_node.rs
@@ -27,8 +27,8 @@ pub struct CometMetricNode<'a> {
pub class: JClass<'a>,
pub method_get_child_node: JMethodID,
pub method_get_child_node_ret: ReturnType,
- pub method_add: JMethodID,
- pub method_add_ret: ReturnType,
+ pub method_set: JMethodID,
+ pub method_set_ret: ReturnType,
}
impl<'a> CometMetricNode<'a> {
@@ -44,8 +44,8 @@ impl<'a> CometMetricNode<'a> {
format!("(I)L{:};", Self::JVM_CLASS).as_str(),
)?,
method_get_child_node_ret: ReturnType::Object,
- method_add: env.get_method_id(Self::JVM_CLASS, "add",
"(Ljava/lang/String;J)V")?,
- method_add_ret: ReturnType::Primitive(Primitive::Void),
+ method_set: env.get_method_id(Self::JVM_CLASS, "set",
"(Ljava/lang/String;J)V")?,
+ method_set_ret: ReturnType::Primitive(Primitive::Void),
class,
})
}
diff --git
a/spark/src/main/scala/org/apache/spark/sql/comet/CometMetricNode.scala
b/spark/src/main/scala/org/apache/spark/sql/comet/CometMetricNode.scala
index 07173c30..47c89d94 100644
--- a/spark/src/main/scala/org/apache/spark/sql/comet/CometMetricNode.scala
+++ b/spark/src/main/scala/org/apache/spark/sql/comet/CometMetricNode.scala
@@ -26,7 +26,7 @@ import org.apache.spark.sql.execution.metric.{SQLMetric,
SQLMetrics}
/**
* A node carrying SQL metrics from SparkPlan, and metrics of its children.
Native code will call
- * [[getChildNode]] and [[add]] to update the metrics.
+ * [[getChildNode]] and [[set]] to update the metrics.
*
* @param metrics
* the mapping between metric name of native operator to `SQLMetric` of
Spark operator. For
@@ -49,14 +49,15 @@ case class CometMetricNode(metrics: Map[String, SQLMetric],
children: Seq[CometM
}
/**
- * Adds a value to a metric. Called from native.
+ * Update the value of a metric. This method will typically be called
multiple times for the
+ * same metric during multiple calls to executePlan.
*
* @param metricName
* the name of the metric at native operator.
* @param v
- * the value to add.
+ * the value to set.
*/
- def add(metricName: String, v: Long): Unit = {
+ def set(metricName: String, v: Long): Unit = {
metrics.get(metricName) match {
case Some(metric) => metric.set(v)
case None =>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]