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

[DO-NOT-MERGE][WIP][MINOR][SQL][TESTS] show tests in SQLQuerySuite correctly in Jenkins #25923

Conversation

HeartSaVioR
Copy link
Contributor

NOTE: I'll change the title and fill out content if it works as expected

What changes were proposed in this pull request?

...TBD...

Why are the changes needed?

...TBD...

Does this PR introduce any user-facing change?

No

How was this patch tested?

Amplab Jenkins build will test the patch.

@HeartSaVioR
Copy link
Contributor Author

HeartSaVioR commented Sep 25, 2019

I'm not sure we should force test names to not contain . (maybe also < and > as well) only for sbt (& Jenkins build), but as it would definitely help on tracking individual test in SQLQuerySuite & ThriftServerQueryTestSuite, I guess it worths to do this.

val testCaseName = absPath.stripPrefix(inputFilePath).stripPrefix(File.separator)
.replace('.', '_')
Copy link
Member

Choose a reason for hiding this comment

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

@HeartSaVioR, this way affects individual file testing way. This is a bug in SBT and it affects all tests (see #25630)

Copy link
Member

Choose a reason for hiding this comment

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

We should rather find a way to override SBT's builtin XML reporter but looks not easy.

Copy link
Member

Choose a reason for hiding this comment

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

Or we should find a way to use Scalatest's XML reporter but that seems not working with Java tests given my rough test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HyukjinKwon
Ah OK. Thanks for pointing out. Looks like the code relies on testCase.name in some places.

Would it work if we replace the '.' character with '_' just when we pass the name to test method? I meant here:

// Create a test case to run this case.
test(testCase.name) {
  runTest(testCase)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I just saw your comments after commenting. Yeah it's ideal if sbt fixes the issue but looks like they don't mind.

IMHO we should apply the workaround for now if we create dynamic tests which end up with same name like here. We may not want to address all the occurrence (like single test having '.') as it's still trackable but this case they're all marked as sql and not trackable in Jenkins.

Copy link
Member

@HyukjinKwon HyukjinKwon Sep 25, 2019

Choose a reason for hiding this comment

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

It affects the test way of selecting individual SQL test files because --z option is based upon test name. I mean this:

* build/sbt "~sql/test-only *SQLQueryTestSuite -- -z inline-table.sql"

Copy link
Contributor Author

@HeartSaVioR HeartSaVioR Sep 25, 2019

Choose a reason for hiding this comment

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

Yes, we might also need to guide it as well. Assuming we don't have another . in test file name, can we just remove postfix of .sql and update javadoc? I hope the change is acceptable, given the change is deterministic and intuitive.

Copy link
Contributor Author

@HeartSaVioR HeartSaVioR Sep 25, 2019

Choose a reason for hiding this comment

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

For adding context, this is to help tracking the issue related to #25913. subquery/scalar-subquery/scalar-subquery-select.sql is failing, but as we know it's just represented as sql and bunch of tests are having same name which bothers with weird UI impact in Jenkins page (clicking sql in Jenkins page is indeterministic now), as well as hard to track among with multiple builds.

@HeartSaVioR
Copy link
Contributor Author

HeartSaVioR commented Sep 25, 2019

FYI, we know about sbt/sbt#2949 which failed to get attention, but new issue sbt/sbt#5114 is filed again which somehow seemed to get attention from repository owner, but owner asked for contribution instead of fixing it by their hands and reporter denied - so kind of stuck. If someone is interested and ambitious about this issue, please go get it.

Some funny thing is, JUnitXmlReportPlugin is described as "experimental" but they enable it by default. We still can't disable this plugin given #25923 (comment)

https://github.com/sbt/sbt/blob/0e69402660685dcd4b12293cce365772b837a0f3/main/src/main/scala/sbt/plugins/JUnitXmlReportPlugin.scala#L14-L24

/**
 * An experimental plugin that adds the ability for junit-xml to be generated.
 *
 *  To disable this plugin, you need to add:
 *  {{{
 *     val myProject = project in file(".") disablePlugins (plugins.JunitXmlReportPlugin)
 *  }}}
 *
 *  Note:  Using AutoPlugins to enable/disable build features is experimental in sbt 0.13.5.
 */
object JUnitXmlReportPlugin extends AutoPlugin {

@SparkQA
Copy link

SparkQA commented Sep 25, 2019

Test build #111321 has finished for PR 25923 at commit febac9f.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HeartSaVioR
Copy link
Contributor Author

Regarding build failure for febac9f :

https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/111321/testReport

- org.apache.spark.sql.SQLQueryTestSuite.blacklist_sql

 Error Details
java.io.FileNotFoundException: /home/jenkins/workspace/SparkPullRequestBuilder@3/sql/core/src/test/resources/sql-tests/results/blacklist.sql.out (No such file or directory)

I guess that's fixed in f714453 but let me confirm with the build result.

@SparkQA
Copy link

SparkQA commented Sep 25, 2019

Test build #111327 has finished for PR 25923 at commit f714453.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -49,7 +50,7 @@ import org.apache.spark.tags.ExtendedSQLTest
*
* To run a single test file upon change:
* {{{
* build/sbt "~sql/test-only *SQLQueryTestSuite -- -z inline-table.sql"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure about this because practically it was good since file names can be matched. Now it cannot be for cosmetic reasons.

I added a clue in the PR I pointed out in order to make debugging easier with the Jenkins output in Github. So currently people at least can identify which file was failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huge win of this workaround is availability of looking into history of individual test. It would provide context which cannot be retrieve from test log, which is really helpful to track down test flakiness.
e.g. https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/111332/testReport/org.apache.spark.sql/SQLQueryTestSuite/typeCoercion_native_mapconcat/history/

Full tests in SQLQueryTestSuite:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/111332/testReport/org.apache.spark.sql/SQLQueryTestSuite/

Full tests in ThriftServerQueryTestSuite (same test can be matched with SQLQueryTestSuite):
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/111332/testReport/org.apache.spark.sql.hive.thriftserver/ThriftServerQueryTestSuite/

So I'm afraid I'm not sure it's just only cosmetic issue. This workaround brings actual benefits, though it has pros and cons, unfortunately. I guess someone would be familiar with file path instead of file path excluding ".sql", so please treat this as a proposal and weigh on current state vs "workaround applied" state.

Copy link
Member

Choose a reason for hiding this comment

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

But this affects existing test way. Can't we find a way to override SBT's XML reporter or to use ScalaTest's XML reporter?

Fixing this in SBT, and upgrading the version should be the standard approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I totally agree that's the way to go, but if no one would like to go forward, that's just an ideal approach. (And that doesn't seem easy to fix the sbt issue with ensuring it doesn't break anything.) sbt/sbt#2949 is filed at Feb. 2017, which is over 2 years ago.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. For the current approach in this PR, I am still not sure due to the downside of changing the existing test way.

I don't think many people actually know build/sbt "~sql/test-only *SQLQueryTestSuite -- -z xxx.sql" is based upon its test name and matching it to the exact file name is pretty good one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think many people actually know build/sbt "~sql/test-only *SQLQueryTestSuite -- -z xxx.sql" is based upon its test name

I'm not sure I could agree with this, as that means this feature is blindly used at all which it shouldn't (as it only applies to *SQLQueryTestSuite). This is even documented in Spark website. Please refer "Testing with SBT" in http://spark.apache.org/developer-tools.html

matching it to the exact file name is pretty good one.

Yes I totally agree it is more intuitive and better. So that's "trade-off". Test history of *SQLQueryTestSuite in Jenkins is just unusable as of now, so personally I think it's worth to weigh on both. Not a strong opinion as I commented before - it's just a proposal.

@SparkQA
Copy link

SparkQA commented Sep 25, 2019

Test build #111332 has finished for PR 25923 at commit b3414a2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HeartSaVioR
Copy link
Contributor Author

I've reached desired result, but it's just a proposal so I'll defer updating title and content of PR until someone supports this idea and would like to merge it.

@HeartSaVioR
Copy link
Contributor Author

Hopefully there's PR sbt/sbt#5139 submitted to address root issue. I'll follow up that PR instead.

@margussipria
Copy link

I wasn't going to fix that root issue (I just disabled that plugin and used Scalatest provided writer) , but then @HyukjinKwon linked that I wasn't only one with this issue, so I started to make tests to fix this issue (and not make things worst for other test suites)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants