Skip to content
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

test: Fix explain with exteded info comet test #436

Merged
merged 3 commits into from
May 16, 2024

Conversation

kazuyukitanimura
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

The test was not properly done due to a typo

What changes are included in this PR?

Fixed the typo as well as a string match bug

How are these changes tested?

@kazuyukitanimura
Copy link
Contributor Author

@@ -1399,7 +1399,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper {
CometConf.COMET_EXEC_ENABLED.key -> "true",
CometConf.COMET_SHUFFLE_ENFORCE_MODE_ENABLED.key -> "true",
CometConf.COMET_EXEC_ALL_OPERATOR_ENABLED.key -> "true",
"spark.sql.extendedExplainProvider" -> "org.apache.comet.ExtendedExplainInfo") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So even we don't config it, the test still can pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it passes because, before Spark 4.0, supportsExtendedExplainInfo in CometTestBase.scala is always false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant previously the config name is wrong, so the config doesn't apply at all. So no matter with or without this config, this test passes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it passes with or without this config for Spark 3.x because the test is disabled by supportsExtendedExplainInfo that is false.

For Spark 4.0 or any Spark fork that implements the extended info, supportsExtendedExplainInfo returns true. Then it fails with the previous wrong config name.

Copy link
Member

@viirya viirya May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but we don't run tests against Spark 4.0 currently, right?

Although it is okay for this PR as it is to fix incorrect config name, it sounds a little strange to have a test that can pass no matter what.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should move this test to Spark 4.0 particular test folder later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another part in the same test that is valid for all Spark versions.
Perhaps, we can consider separating them out in the future cc @parthchandra
Thanks for reviewing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do that @kazuyukitanimura

Copy link
Contributor

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except one nit comment, which is not a blocker.

@@ -249,7 +249,7 @@ abstract class CometTestBase
var dfSpark: Dataset[Row] = null
withSQLConf(
CometConf.COMET_ENABLED.key -> "false",
"spark.sql.extendedExplainProvider" -> "") {
"spark.sql.extendedExplainProviders" -> "") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we make this literal as a constant filed in this CometTestBase such as how we define org.apache.spark.sql.CometTestBase#shuffleManager?

It could be reused in CometExpressionSuite.scala as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, and do we really need to pass this param with blank value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks,

nit: could we make this literal as a constant

I added the constant in a shim because it is defined in Spark 4.0

do we really need to pass this param with blank value?

Yes, the caller of this method (CometExpressionSuite) defines a value and need to overwrite.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @kazuyukitanimura

@@ -259,7 +259,7 @@ abstract class CometTestBase
dfSpark.queryExecution.explainString(ExtendedMode),
dfComet.queryExecution.explainString(ExtendedMode))
if (supportsExtendedExplainInfo(dfSpark.queryExecution)) {
assert(diff.contains(expectedInfo))
assert(expectedInfo.exists(s => diff.contains(s)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to have all expected info in the diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Updated

@viirya viirya merged commit 7fe20b1 into apache:main May 16, 2024
40 checks passed
@viirya
Copy link
Member

viirya commented May 16, 2024

Merged. Thanks @kazuyukitanimura @andygrove @advancedxy @comphead

@kazuyukitanimura
Copy link
Contributor Author

Thank you all!

himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
* test: Fix explain with exteded info comet test

* address review comments

* address review comments

(cherry picked from commit 7fe20b1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants