ZiyaZa commented on code in PR #55511:
URL: https://github.com/apache/spark/pull/55511#discussion_r3155762148
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DeleteFromTableExec.scala:
##########
@@ -21,14 +21,21 @@ import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.Attribute
import org.apache.spark.sql.connector.catalog.SupportsDeleteV2
import org.apache.spark.sql.connector.expressions.filter.Predicate
+import org.apache.spark.sql.execution.metric.SQLMetric
case class DeleteFromTableExec(
table: SupportsDeleteV2,
condition: Array[Predicate],
- refreshCache: () => Unit) extends LeafV2CommandExec {
+ refreshCache: () => Unit)
+ extends LeafV2CommandExec
+ with SupportsCustomDriverMetrics {
+
+ override lazy val customMetrics: Map[String, SQLMetric] =
+ createCustomMetrics(table.supportedCustomMetrics())
override protected def run(): Seq[InternalRow] = {
table.deleteWhere(condition)
+ postDriverMetrics(table.reportDriverMetrics())
Review Comment:
Moved to `finally`.
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/TruncatableTable.java:
##########
@@ -34,4 +36,21 @@ public interface TruncatableTable extends Table {
* @since 3.2.0
*/
boolean truncateTable();
+
+ /**
+ * Returns an array of supported custom metrics with name and description.
+ * By default it returns empty array.
+ */
+ default CustomMetric[] supportedCustomMetrics() {
Review Comment:
Added.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]