-
Notifications
You must be signed in to change notification settings - Fork 297
fix: Native_datafusion reports correct files and bytes scanned #3798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| withSQLConf( | ||||||
| CometConf.COMET_ENABLED.key -> "true", | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @comphead for review. I added this to the latest commit. |
||||||
| 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, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| s"Expected exactly 2 files to be scanned, but got metrics reporting $numFiles") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| } | ||||||
|
|
||||||
| case class BucketedTableTestSpec( | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.