@@ -98,6 +98,22 @@ object CometMetricNode {
9898 " total time (in ms) spent in this operator" ))
9999 }
100100
101+ /**
102+ * Base SQL Metrics for ScanExec and BatchScanExec These are needed for various Spark systems to
103+ * function properly, and are calculated on the general iterator created by the scan operator,
104+ * regardless of which scan implementation is used.
105+ */
106+ def baseScanMetrics (sc : SparkContext ): Map [String , SQLMetric ] = {
107+ Map (
108+ " numOutputRows" -> SQLMetrics .createMetric(sc, " number of output rows" ),
109+ " scanTime" -> SQLMetrics .createNanoTimingMetric(sc, " scan time" ))
110+ }
111+
112+ /**
113+ * Metrics specific to Parquet format in scan operators. This provides some statistics about the
114+ * read files, as well as some meta filtering occuring. These metrics are independent of the
115+ * native reader metrics.
116+ */
101117 def parquetScanMetrics (sc : SparkContext ): Map [String , SQLMetric ] = {
102118 Map (
103119 " ParquetRowGroups" -> SQLMetrics .createMetric(sc, " num of Parquet row groups read" ),
@@ -121,12 +137,11 @@ object CometMetricNode {
121137 " read throughput when reading Parquet file from storage (MB/sec)" ))
122138 }
123139
140+ /**
141+ * SQL Metrics from the native Datafusion reader.
142+ */
124143 def nativeScanMetrics (sc : SparkContext ): Map [String , SQLMetric ] = {
125144 Map (
126- // Spark metrics for streaming pipelines
127- " numOutputRows" -> SQLMetrics .createMetric(sc, " number of output rows" ),
128- " scanTime" -> SQLMetrics .createNanoTimingMetric(sc, " scan time" ),
129- // Datafusion reader metrics
130145 " output_rows" -> SQLMetrics .createMetric(sc, " number of output rows" ),
131146 " time_elapsed_opening" ->
132147 SQLMetrics .createNanoTimingMetric(sc, " Wall clock time elapsed for file opening" ),
0 commit comments