comphead commented on code in PR #3798:
URL: https://github.com/apache/datafusion-comet/pull/3798#discussion_r3028853986
##########
spark/src/test/scala/org/apache/comet/exec/CometExecSuite.scala:
##########
@@ -2173,6 +2173,39 @@ class CometExecSuite extends CometTestBase {
}
}
+ test("Native_datafusion reports correct files and bytes scanned") {
+ withTempDir { dir =>
+ val path = new java.io.File(dir, "test_metrics").getAbsolutePath
+ spark.range(100).repartition(2).write.mode("overwrite").parquet(path)
+
+ withSQLConf(
+ CometConf.COMET_ENABLED.key -> "true",
+ CometConf.COMET_EXEC_ENABLED.key -> "true",
+ CometConf.COMET_NATIVE_SCAN_IMPL.key -> "native_datafusion") {
+ val df = spark.read.parquet(path)
+
+ // Trigger two different actions to ensure metrics are not duplicated
+ df.count()
+ df.collect()
+
+ val scanNode = stripAQEPlan(df.queryExecution.executedPlan)
+ .collectFirst {
+ case n: org.apache.spark.sql.comet.CometNativeScanExec => n
+ case n: org.apache.spark.sql.comet.CometScanExec => n
+ }
+ .getOrElse {
+ fail(
+ s"Comet scan node not found in the physical plan. Plan:
\n${df.queryExecution.executedPlan}")
+ }
+
+ val numFiles = scanNode.metrics("numFiles").value
+ assert(
+ numFiles == 2,
+ s"Expected exactly 2 files to be scanned, but got metrics reporting
$numFiles")
Review Comment:
```suggestion
s"Expected exactly $inputFiles files to be scanned, but got
metrics reporting $numFiles")
```
--
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]