Skip to content

[SPARK-14358] Change SparkListener from a trait to an abstract class #12142

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

Closed
wants to merge 4 commits into from

Conversation

rxin
Copy link
Contributor

@rxin rxin commented Apr 4, 2016

What changes were proposed in this pull request?

Scala traits are difficult to maintain binary compatibility on, and as a result we had to introduce JavaSparkListener. In Spark 2.0 we can change SparkListener from a trait to an abstract class and then remove JavaSparkListener.

How was this patch tested?

Updated related unit tests.

@rxin
Copy link
Contributor Author

rxin commented Apr 4, 2016

cc @JoshRosen

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54821 has finished for PR 12142 at commit 05e4c5e.

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

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54823 has finished for PR 12142 at commit 7112bf2.

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

@@ -249,6 +250,8 @@ trait SparkListener {
* Called when other events like SQL-specific events are posted.
*/
def onOtherEvent(event: SparkListenerEvent) { }

// WHENEVER WE ADD A METHOD HERE, PLEASE ALSO UPDATE SparkFirehoseListener.

Choose a reason for hiding this comment

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

We can have both this abstract class and also an interface? That way the SparkFirehoseListener can just implement the interface instead of extending the abstract class. Not sure if that is a better situation or not - it does make it more flexible though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not a bad idea actually -- would require a lot of code changes though ...

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.e. we should change all the places that accept SparkListener to accept the SparkListenerInterface

@ksakellis
Copy link

Just that minor question but otherwise LGTM

@rxin
Copy link
Contributor Author

rxin commented Apr 4, 2016

OK updated.

* Simple SparkListener that logs a few summary statistics when each stage completes.
*/
@DeveloperApi
class StatsReportListener extends SparkListener with Logging {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was simply moved from one file into a new file.

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #2736 has finished for PR 12142 at commit 7112bf2.

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

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54831 has finished for PR 12142 at commit 4f4644d.

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

@andrewor14
Copy link
Contributor

Looks good. This will break cases where the user has a class that listens for Spark events but already extends some parent, but that's probably OK.

@andrewor14
Copy link
Contributor

Ok merged into master.

@asfgit asfgit closed this in 7143904 Apr 4, 2016
asfgit pushed a commit that referenced this pull request Apr 8, 2016
Currently all `SparkFirehoseListener` implementations are broken since we expect listeners to extend `SparkListener`, while the fire hose only extends `SparkListenerInterface`.  This changes the addListener function and the config based injection to use the interface instead.

The existing tests in SparkListenerSuite are improved such that they would have caught this.

Follow-up to #12142

Author: Michael Armbrust <michael@databricks.com>

Closes #12227 from marmbrus/fixListener.
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.

4 participants