[AURON #1602] Implement AuronAdaptor SPI discovery with Spark provider#1620
[AURON #1602] Implement AuronAdaptor SPI discovery with Spark provider#1620richox merged 2 commits intoapache:masterfrom
Conversation
Tartarus0zm
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
You can add a test to verify whether cases like NativeShuffleExchangeExec.write have been fixed.
| "auron.partialAggSkipping.minRows") | ||
| .description("minimum number of rows to trigger partial aggregate skipping.") | ||
| .intType() | ||
| .defaultValue( |
There was a problem hiding this comment.
This modification will change the default behavior.
There was a problem hiding this comment.
removed this because it causes NPE in SparkAuronConfigurationTest, the UT doesn't initialize SparkEnv, and AuronAdaptor.getAuronConfiguration() depends on it to get SparkConf, triggering NPE.
public AuronConfiguration getAuronConfiguration() {
return new SparkAuronConfiguration(SparkEnv$.MODULE$.get().conf()); // NPE in UT
}
I'll try to fix the UT first.
Do you have any better suggestions?
There was a problem hiding this comment.
@Tartarus0zm
this is a design flaw in SparkAuronConfiguration. Static initialization must not depend on runtime singletons like AuronAdaptor.getInstance().getAuronConfiguration(). because:
- It creates a circular dependency:
SparkAuronConfiguration → AuronAdaptor → SparkAuronConfiguration - Static defaults must be pure constants
In this PR, remove this code. Then we’ll open a follow-up issue to properly redesign SparkAuronConfiguration. What do you think?”
There was a problem hiding this comment.
removed this because it causes NPE in
SparkAuronConfigurationTest, the UT doesn't initializeSparkEnv, andAuronAdaptor.getAuronConfiguration()depends on it to get SparkConf, triggering NPE.public AuronConfiguration getAuronConfiguration() { return new SparkAuronConfiguration(SparkEnv$.MODULE$.get().conf()); // NPE in UT }I'll try to fix the UT first. Do you have any better suggestions?
@yew1eb Thanks for your feedback.
It appears our current configuration design has some shortcomings. Typically, a configuration item's default value should not depend on another configuration item. Such cases are usually resolved through code. This is a legacy issue. I will resolve this issue in #1621 as soon as possible.
@Tartarus0zm A direct test for Any suggestions for a stronger test? Happy to improve if there's a better approach! |
@yew1eb Thank you for your clarification. |
|
Rebased this PR -- it depends on the #1621 fix. @richox @merrily01 , could you please review when you have time ? Thanks! |
|
@richox @merrily01 please take a look and let me know if there are any issues. |
Which issue does this PR close?
Closes #1602 .
Rationale for this change
Decouples the initialization of the
AuronAdaptorinstance from the dependency on the implementation ofSparkAuronAdaptorthrough the SPI mechanism.What changes are included in this PR?
AuronAdaptor.getInstance()to use double-checked locking +ServiceLoaderAuronAdaptorProviderSPI interfaceSparkAuronAdaptorProviderinspark-extensionMETA-INF/servicesinspark-extensionAre there any user-facing changes?
No
How was this patch tested?
Unit tests in
AuronAdaptorTest:MockAuronAdaptorviaMETA-INF/services.