Skip to content

Conversation

@vanzin
Copy link
Contributor

@vanzin vanzin commented Sep 21, 2017

This change adds a new SQL config key that is equivalent to SparkContext's
"spark.extraListeners", allowing users to register QueryExecutionListener
instances through the Spark configuration system instead of having to
explicitly do it in code.

The code used by SparkContext to implement the feature was refactored into
a helper method in the Utils class, and SQL's ExecutionListenerManager was
modified to use it to initialize listener declared in the configuration.

Unit tests were added to verify all the new functionality.

… automatically.

This change adds a new SQL config key that is equivalent to SparkContext's
"spark.extraListeners", allowing users to register QueryExecutionListener
instances through the Spark configuration system instead of having to
explicitly do it in code.

The code used by SparkContext to implement the feature was refactored into
a helper method in the Utils class, and SQL's ExecutionListenerManager was
modified to use it to initialize listener declared in the configuration.

Unit tests were added to verify all the new functionality.
@SparkQA
Copy link

SparkQA commented Sep 21, 2017

Test build #82041 has finished for PR 19309 at commit c52fd71.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • s\"$name is not a subclass of $
  • .doc(\"List of class names implementing QueryExecutionListener that will be automatically \" +

@vanzin
Copy link
Contributor Author

vanzin commented Sep 25, 2017

/cc @gatorsmile @cloud-fan

Copy link
Contributor

@squito squito left a comment

Choose a reason for hiding this comment

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

lgtm, a small question on the UnsupportedOperationException handling.


case e: InvocationTargetException =>
e.getCause() match {
case _: UnsupportedOperationException =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit worried catching UnsupportedOperationException is a bit too general ... what if its thrown by something else deep inside the extension class? The user won't get to see what happened.

OTOH, I can't think of anything better to catch (doesn't seem worth a special exception type). Maybe log the entire exception at debug level?

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 wanted to avoid adding a special new exception for this. I'll add the log.

@SparkQA
Copy link

SparkQA commented Sep 28, 2017

Test build #82287 has finished for PR 19309 at commit bcc44e9.

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

@gatorsmile
Copy link
Member

Will review it this weekend.


test("register query execution listeners using configuration") {
val conf = new SparkConf(false)
.set(QUERY_EXECUTION_LISTENERS, Seq(classOf[CountingQueryExecutionListener].getName()))
Copy link
Member

Choose a reason for hiding this comment

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

Now, this test only has one single listener whose constructor has zero arg. Could you add one more with a SparkConf arg in the constructor?

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 covered by UtilsSuite already.

@gatorsmile
Copy link
Member

retest this please

@gatorsmile
Copy link
Member

gatorsmile commented Oct 10, 2017

Let me summarize the PR. Please correct me if anything is missing.

Background

Currently, our users can register a listener one by one during the executions by calling the SparkContext API:

def addSparkListener(listener: SparkListenerInterface)

Users also can specify them through the Conf spark.extraListeners. SparkContext will automatically register the extra listeners during the initialization phase.

In Spark SQL, QueryExecutionListener enables users to register QueryExecutionListener by calling the API

def register(listener: QueryExecutionListener)

Proposal

This PR is proposing to add a similar static SQLConf spark.sql.queryExecutionListeners. When a Spark session is built/cloned, the query execution listeners specified in the new conf will be registered automatically.

@vanzin
Copy link
Contributor Author

vanzin commented Oct 10, 2017

That's basically what the PR summary says.

@SparkQA
Copy link

SparkQA commented Oct 10, 2017

Test build #82597 has finished for PR 19309 at commit bcc44e9.

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

@gatorsmile
Copy link
Member

LGTM

@gatorsmile
Copy link
Member

Thanks! Merged to master.

@asfgit asfgit closed this in bd4eb9c Oct 10, 2017
@vanzin vanzin deleted the SPARK-19558 branch October 13, 2017 23:15
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