-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31831][SQL][TESTS] Use subclasses for mock in HiveSessionImplSuite #29069
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
Conversation
|
cc @HeartSaVioR |
|
Unfortunately it turned out my patch didn't fix the issue (so I'm OK to revert my patch if we want to) - that said, I'd like to see the analysis how it fixes the issue if the approach still relies on mock. I'd be comfortable if the approach uses subclassing. I'm seeing frequent failures on it - probably it's time to consider disabling the suite? |
|
I think the default one uses |
|
that's the code for |
|
Turns out our class of mock doesn't have a complicated constructor. |
|
ok to test |
|
I don't know about the details in mockito mock mechanism, but according to the error message and the stack trace, my bet for the problematic spot is I'd say we may need to probably check the thread context classloader just before calling mock, and whether it can find MockAccess. That's why I'd like to just avoid mocking and see manual subclass to just make test work. |
|
ok to test |
|
Test build #125686 has finished for PR 29069 at commit
|
|
Yeah, I changed to use the subclasses for mocking. I think it is a classloader issue with threading. |
|
Test build #125697 has finished for PR 29069 at commit
|
|
Test build #125698 has finished for PR 29069 at commit
|
|
Test build #125701 has finished for PR 29069 at commit
|
|
Test build #125702 has finished for PR 29069 at commit
|
|
@frankyin-factual Below change (+ imports) would make you get rid of new java files: |
|
Just pushed such changes. |
HeartSaVioR
left a comment
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 pending Jenkins
|
Test build #125713 has finished for PR 29069 at commit
|
|
Thanks for working on this, @HeartSaVioR and @frankyin-factual . |
|
Thanks! Merged into master. |
|
Hi, @HeartSaVioR and @frankyin-factual . |
| import org.mockito.invocation.InvocationOnMock | ||
| import org.apache.hive.service.cli.operation.{GetCatalogsOperation, Operation, OperationManager} | ||
| import org.apache.hive.service.cli.session.{HiveSession, HiveSessionImpl, SessionManager} | ||
| import org.apache.hive.service.rpc.thrift.{THandleIdentifier, TOperationHandle, TOperationType} |
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.
According to the compilation error, this import is invalid in Hive 1.2.
|
cc @gatorsmile since he has been interested in |
|
Let's revert if it's non trivial to fix @HeartSaVioR. |
|
I'll take a look at it today. We can revert it if there's no good way to fix. |
|
I will also take a look. |
|
I guess we have several possible approaches here:
I guess the straightforward approach would be 1 - I guess it should work smoothly, though if we want to ensure the suite runs in both versions we'll end up with duplicating codes. If that doesn't matter much we can just do that, or even we can just enable the test on hive 2.3 only (as the suite is technically irrelevant to Hive 1.2 vs Hive 2.3). Less redundant but more complicated would be 2. I'm not 100% sure how much complexity is needed to make a shim for the suite, and not sure it worths to do instead of simply allowing redundant codes a bit. The simplest approach would be 3, but it's not guaranteed to fix the flakiness. I'd say it'd be better to leave as the last resort. WDYT? |
|
Thank you. I'm fine for all combination (including Hive 2.3 only testing). Please feel free to choose an option. From my side, this also looks not urgent since this is not blocking both GitHub Action and PRBuilder. It has been broken over 3 days already. I hope In short, please proceed toward what you think is right, @HeartSaVioR . |
|
I am working on a combination of 1) and 2). Will push shortly. |
…e in hive version related subdirectories ### What changes were proposed in this pull request? This patch fixes the build issue on Hive 1.2 profile brought by #29069, via putting mocks for HiveSessionImplSuite in hive version related subdirectories, so that maven build will pick up the proper source code according to the profile. ### Why are the changes needed? #29069 fixed the flakiness of HiveSessionImplSuite, but given the patch relied on the default profile (Hive 2.3) it broke the build with Hive 1.2 profile. This patch addresses both Hive versions. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually confirmed the test suite via below command: > Hive 1.2 ``` build/mvn -Dtest=none -DwildcardSuites=org.apache.spark.sql.hive.thriftserver.HiveSessionImplSuite test -Phive-1.2 -Phadoop-2.7 -Phive-thriftserver ``` > Hive 2.3 ``` build/mvn -Dtest=none -DwildcardSuites=org.apache.spark.sql.hive.thriftserver.HiveSessionImplSuite test -Phive-2.3 -Phadoop-3.2 -Phive-thriftserver ``` Closes #29129 from frankyin-factual/hive-tests. Authored-by: Frank Yin <[email protected]> Signed-off-by: Jungtaek Lim (HeartSaVioR) <[email protected]>
What changes were proposed in this pull request?
Fix flaky test org.apache.spark.sql.hive.thriftserver.HiveSessionImplSuite by using subclasses to avoid classloader issue.
Why are the changes needed?
It causes build instability.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
It is a fix for a flaky test, but need to run multiple times against Jenkins.