Skip to content

Conversation

@kunalkhamar
Copy link
Contributor

@kunalkhamar kunalkhamar commented Mar 21, 2017

What changes were proposed in this pull request?

Bugfix from SPARK-19540.
Cloning SessionState does not clone query execution listeners, so cloned session is unable to listen to events on queries.

How was this patch tested?

  • Unit test

@SparkQA
Copy link

SparkQA commented Mar 21, 2017

Test build #75002 has finished for PR 17379 at commit ad77fe9.

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

@kunalkhamar
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Mar 22, 2017

Test build #75015 has finished for PR 17379 at commit ad77fe9.

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

@SparkQA
Copy link

SparkQA commented Mar 23, 2017

Test build #75066 has finished for PR 17379 at commit f63e81d.

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

Copy link
Contributor

@tdas tdas left a comment

Choose a reason for hiding this comment

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

overall, i am confused as to why listener is not being passed as a constructor param, rather as a complicated override.

And why are docs being removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

why have you removed these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These comments are adding little or no value. We should remove or make them more detailed, which would you prefer? If the latter, what's a good doc for shared state and experimental methods?

Copy link
Contributor Author

@kunalkhamar kunalkhamar Mar 28, 2017

Choose a reason for hiding this comment

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

Added it back, hopefully more descriptive.

Copy link
Contributor

Choose a reason for hiding this comment

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

why have these been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each of these is identical to their SessionState counterpart and should be inherited by Scaladoc comment inheritance, do we still need them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HiveSessionState is gone, so this is not relevant anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do it this way? Why not pass it as a constructor param?

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 think the general rule we followed in the cloneSession PR is that vals that directly depend on SparkSession to be initialized, are to be constructor params. We leave the other vals in the body of class.
The advantage here is less duplicated code between SessionState, HiveSessionState and TestHiveSparkSession.
This is consistent with that, what would be the advantage of changing it to be a param?

Copy link
Contributor Author

@kunalkhamar kunalkhamar Mar 28, 2017

Choose a reason for hiding this comment

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

Builders were added in SPARK-20100. Changed initialization to use that pattern, so it is a constructor param now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment on what it creates? what the two things returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: cleaner to do

class CommandCollector extends QueryExecutionListener {
  val commands = ...
  ...
} 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

neat, changed.

@SparkQA
Copy link

SparkQA commented Mar 24, 2017

Test build #75135 has finished for PR 17379 at commit eb5581a.

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

@SparkQA
Copy link

SparkQA commented Mar 28, 2017

Test build #75328 has finished for PR 17379 at commit 16f5bea.

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

@SparkQA
Copy link

SparkQA commented Mar 29, 2017

Test build #75331 has finished for PR 17379 at commit cad1b63.

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

Copy link
Contributor

@tdas tdas left a comment

Choose a reason for hiding this comment

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

Few minor comments.
@hvanhovell should take a look too.

val conf: SQLConf,
val experimentalMethods: ExperimentalMethods,
val functionRegistry: FunctionRegistry,
val udf: UDFRegistration,
Copy link
Contributor

Choose a reason for hiding this comment

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

udf -> udfRegistration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

*
* Note 1: The user-defined functions must be deterministic.
* Note 2: This depends on the `functionRegistry` field.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

This file only contains effectively one builder. So it should be named after the class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It also contains a mix-in WithTestConf. But renaming is fine.

* Builder that produces a Hive aware [[SessionState]].
*/
@Experimental
@InterfaceStability.Unstable
Copy link
Contributor

Choose a reason for hiding this comment

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

This file should not be named HiveSessionState anymore. It doesnt even have the class HiveSessionState. It does have an object HiveSession, but do we need that object any more?
@hvanhovell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed, removed object HiveSessionState.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, lets rename the file to HiveSessionBuilder.scala

@SparkQA
Copy link

SparkQA commented Mar 29, 2017

Test build #75337 has finished for PR 17379 at commit be191c6.

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

@SparkQA
Copy link

SparkQA commented Mar 29, 2017

Test build #75338 has finished for PR 17379 at commit 119dae9.

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

@kunalkhamar
Copy link
Contributor Author

cc @hvanhovell

*
* Note 1: The user-defined functions must be deterministic.
* Note 2: This depends on the `functionRegistry` field.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I was wondering why you moved this into the builder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was the only thing not initialized in the builder, thought it would be more consistent to have all initialization in the builder. Is this okay?

Copy link
Contributor

@hvanhovell hvanhovell left a comment

Choose a reason for hiding this comment

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

@kunalkhamar could you rename HiveSessionState into HiveSessionStateBuilder? Other than that, LGTM.

@kunalkhamar
Copy link
Contributor Author

kunalkhamar commented Mar 29, 2017

@hvanhovell cool, it should be HiveSessionStateBuilder now.

@hvanhovell
Copy link
Contributor

Merging to master. Thanks!

@asfgit asfgit closed this in 142f6d1 Mar 29, 2017
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