Skip to content
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

Fix share state behavior in ThriftServer #437

Merged
merged 2 commits into from
Sep 5, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions core/src/main/scala/org/apache/spark/sql/TiSparkSession.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ import org.apache.spark.{SparkConf, SparkContext}

class TiSparkSession(
@transient override val sparkContext: SparkContext,
@transient private val existingSharedState: Option[SharedState]
@transient private val tiExistingSharedState: Option[SharedState]
) extends SparkSession(sparkContext) {

private[sql] def this(sc: SparkContext) {
this(sc, None)
}

@transient
override lazy val sharedState: SharedState = new SharedState(sparkContext)
override lazy val sessionState: SessionState = new TiSessionState(this)

@transient
override lazy val sessionState: SessionState = new TiSessionState(this)
override private[sql] lazy val sharedState: SharedState = {
tiExistingSharedState.getOrElse(new SharedState(sparkContext))
}

override def newSession(): SparkSession = new TiSparkSession(sparkContext, Some(sharedState))

Expand Down