-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-15073][SQL] Hide SparkSession constructor from the public #12873
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ import org.apache.spark.util.Utils | |
| * {{{ | ||
| * SparkSession.builder() | ||
| * .master("local") | ||
| * .appName("Word Count") | ||
| * .config("spark.some.config.option", "some-value"). | ||
| * .getOrCreate() | ||
| * }}} | ||
|
|
@@ -63,7 +64,7 @@ class SparkSession private( | |
| @transient private val existingSharedState: Option[SharedState]) | ||
| extends Serializable with Logging { self => | ||
|
|
||
| def this(sc: SparkContext) { | ||
| private[sql] def this(sc: SparkContext) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually is it possible to just make this private?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use this in SQLContext
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we should change that and have sqlcontext always getting it from sparksession tiself?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I think the problem is that in |
||
| this(sc, None) | ||
| } | ||
|
|
||
|
|
@@ -573,7 +574,7 @@ class SparkSession private( | |
| * common Scala objects into [[DataFrame]]s. | ||
| * | ||
| * {{{ | ||
| * val sparkSession = new SparkSession(sc) | ||
| * val sparkSession = SparkSession.builder.getOrCreate() | ||
| * import sparkSession.implicits._ | ||
| * }}} | ||
| * | ||
|
|
@@ -586,6 +587,15 @@ class SparkSession private( | |
| } | ||
| // scalastyle:on | ||
|
|
||
| /** | ||
| * Stop the underlying [[SparkContext]]. | ||
| * | ||
| * @since 2.0.0 | ||
| */ | ||
| def stop(): Unit = { | ||
| sparkContext.stop() | ||
| } | ||
|
|
||
| protected[sql] def parseSql(sql: String): LogicalPlan = { | ||
| sessionState.sqlParser.parsePlan(sql) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not identical. The previous one will create a new spark session anyway, but the new one may not create a new spark session if sparkContext already exists. Then we can't guarantee the returned spark session supports hive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch