Skip to content

Commit

Permalink
[SPARK-11485][SQL] Make DataFrameHolder and DatasetHolder public.
Browse files Browse the repository at this point in the history
These two classes should be public, since they are used in public code.

Author: Reynold Xin <[email protected]>

Closes #9445 from rxin/SPARK-11485.
  • Loading branch information
rxin committed Nov 4, 2015
1 parent 27feafc commit cd1df66
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ object MimaExcludes {
"org.apache.spark.sql.UDFRegistration.org$apache$spark$sql$UDFRegistration$$builder$23"),
ProblemFilters.exclude[MissingMethodProblem](
"org.apache.spark.sql.UDFRegistration.org$apache$spark$sql$UDFRegistration$$builder$24")
) ++ Seq(
// SPARK-11485
ProblemFilters.exclude[MissingMethodProblem]("org.apache.spark.sql.DataFrameHolder.df")
)
case v if v.startsWith("1.5") =>
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ package org.apache.spark.sql
/**
* A container for a [[DataFrame]], used for implicit conversions.
*
* To use this, import implicit conversions in SQL:
* {{{
* import sqlContext.implicits._
* }}}
*
* @since 1.3.0
*/
private[sql] case class DataFrameHolder(df: DataFrame) {
case class DataFrameHolder private[sql](private val df: DataFrame) {

// This is declared with parentheses to prevent the Scala compiler from treating
// `rdd.toDF("1")` as invoking this toDF and then apply on the returned DataFrame.
Expand Down
11 changes: 8 additions & 3 deletions sql/core/src/main/scala/org/apache/spark/sql/DatasetHolder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
package org.apache.spark.sql

/**
* A container for a [[DataFrame]], used for implicit conversions.
* A container for a [[Dataset]], used for implicit conversions.
*
* @since 1.3.0
* To use this, import implicit conversions in SQL:
* {{{
* import sqlContext.implicits._
* }}}
*
* @since 1.6.0
*/
private[sql] case class DatasetHolder[T](df: Dataset[T]) {
case class DatasetHolder[T] private[sql](private val df: Dataset[T]) {

// This is declared with parentheses to prevent the Scala compiler from treating
// `rdd.toDF("1")` as invoking this toDF and then apply on the returned DataFrame.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ abstract class SQLImplicits {
DatasetHolder(_sqlContext.createDataset(rdd))
}

/**
* Creates a [[Dataset]] from a local Seq.
* @since 1.6.0
*/
implicit def localSeqToDatasetHolder[T : Encoder](s: Seq[T]): DatasetHolder[T] = {
DatasetHolder(_sqlContext.createDataset(s))
}
Expand Down

0 comments on commit cd1df66

Please sign in to comment.