-
Notifications
You must be signed in to change notification settings - Fork 176
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
feat: Add manual test to calculate spark builtin functions coverage #263
Conversation
files need to be excluded from RAT |
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.
Nice, this is pretty neat!
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.
This is great work. Left two comments.
spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala
Outdated
Show resolved
Hide resolved
spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala
Outdated
Show resolved
Hide resolved
spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala
Outdated
Show resolved
Hide resolved
"select result, d._2 as reason, count(1) cnt from (select name, t.details.result, explode_outer(t.details.details) as d from t) group by 1, 2"), | ||
500, | ||
0) | ||
Files.write(Paths.get("doc/spark_coverage_agg.txt"), str_agg.getBytes(StandardCharsets.UTF_8)) |
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.
Files.write(Paths.get("doc/spark_coverage_agg.txt"), str_agg.getBytes(StandardCharsets.UTF_8)) | |
Files.write(Paths.get("doc/spark_agg_expr_coverage.txt"), str_agg.getBytes(StandardCharsets.UTF_8)) |
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.
Oh, the file is not for aggregation expression. nvm.
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.
But I think it may be better to have the aggregation of expression coverage in the same file?
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.
Filed #282
doc/spark_coverage.txt
Outdated
@@ -0,0 +1,421 @@ | |||
+---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |||
|name |details | |
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.
I'm wondering if we can produce a markdown document instead of plain text. So it can be displayed in format. We can do it in follow up.
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.
Filed #282
doc/spark_coverage_agg.txt
Outdated
|FAILED |Failed on native side |4 | | ||
|PASSED |OK |254| | ||
|SKIPPED|null |12 | | ||
|FAILED |Failed on something else. Check query manually|10 | |
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.
Hmm, I'm not sure I understand what this document represents?
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.
SKIPPED means the indicator, there is no examples in the spark catalog, I'll add more meaningful message
spark/src/test/scala/org/apache/comet/CometExpressionCoverageSuite.scala
Outdated
Show resolved
Hide resolved
Something is wrong with TPC-DS Correctness it runs for 5 hours and stuck on downloadin Maven deps |
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.
LGTM, except some minor comments which could be addressed in followup PRs.
|
||
import testImplicits._ | ||
|
||
private val rawCoverageFilePath = "doc/spark_builtin_expr_coverage.txt" |
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.
After a second thought, I think maybe we should add spark version in this file name. More functions will be added in new spark version. It might be helpful to indicate how many functions are supported in each Spark version.
This can be done in a follow up though
Files.write(Paths.get(aggCoverageFilePath), str_agg.getBytes(StandardCharsets.UTF_8)) | ||
|
||
val str = showString(spark.sql("select * from t order by 1"), 1000, 0) | ||
Files.write(Paths.get(rawCoverageFilePath), str.getBytes(StandardCharsets.UTF_8)) |
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.
I second @viirya's point, #263 (comment). It would be better to put the aggregated result in the same file.
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.
Ah, I see you filed a new issue. It could be addressed in a followup PR then.
|FAILED |Failed on native side |16 | | ||
|FAILED |Failed on something else. Check query manually |4 | | ||
|PASSED |OK |101| | ||
|SKIPPED|No examples found in spark.sessionState.functionRegistry|12 | |
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.
I'm thinking to have this aggregated summary in the expr coverage file too. It will be more readable. We can do it in making the coverage file as markdown format.
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.
yes, I combined all of that in #282
// disable constant folding. This optimization rule precompute and select value as literal | ||
// which subsequently leads to false positives | ||
// | ||
// ConstantFolding is a operator optimization rule in Catalyst that replaces expressions | ||
// that can be statically evaluated with their equivalent literal values. |
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.
This function doesn't always exclude ConstantFolding
but passed in ones. This comment should be moved to where you pass ConstantFolding
when you call testSingleLineQuery
in CometExpressionCoverageSuite
.
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.
A few minor comments.
Which issue does this PR close?
Closes #.
Related to #240
Rationale for this change
Comet needs a tool to evaluate which spark builtin functions are currently supported by Comet with native execution
What changes are included in this PR?
The PR includes the manual test
CometExpressionCoverageSuite
which will create 2 filesdoc/spark_coverage.txt
,doc/spark_coverage_agg.txt
containing current coverage situationHow are these changes tested?