Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ object MimaExcludes {
ProblemFilters.exclude[MissingClassProblem](
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD"),
ProblemFilters.exclude[MissingClassProblem](
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD$")
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD$"),
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.sql.SparkSQLParser")
) ++ Seq(
// SPARK-11485
ProblemFilters.exclude[MissingMethodProblem]("org.apache.spark.sql.DataFrameHolder.df"),
Expand Down
20 changes: 11 additions & 9 deletions sql/core/src/main/scala/org/apache/spark/sql/Column.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private[sql] object Column {

/**
* A [[Column]] where an [[Encoder]] has been given for the expected input and return type.
* @since 1.6.0
* To create a [[TypedColumn]], use the `as` function on a [[Column]].
*
* @tparam T The input type expected for this expression. Can be `Any` if the expression is type
* checked by the analyzer instead of the compiler (i.e. `expr("sum(...)")`).
* @tparam U The output type of this column.
Expand All @@ -51,7 +52,8 @@ private[sql] object Column {
*/
class TypedColumn[-T, U](
expr: Expression,
private[sql] val encoder: ExpressionEncoder[U]) extends Column(expr) {
private[sql] val encoder: ExpressionEncoder[U])
extends Column(expr) {

/**
* Inserts the specific input type and schema into any expressions that are expected to operate
Expand All @@ -61,12 +63,11 @@ class TypedColumn[-T, U](
inputEncoder: ExpressionEncoder[_],
schema: Seq[Attribute]): TypedColumn[T, U] = {
val boundEncoder = inputEncoder.bind(schema).asInstanceOf[ExpressionEncoder[Any]]
new TypedColumn[T, U] (expr transform {
case ta: TypedAggregateExpression if ta.aEncoder.isEmpty =>
ta.copy(
aEncoder = Some(boundEncoder),
children = schema)
}, encoder)
new TypedColumn[T, U](
expr transform { case ta: TypedAggregateExpression if ta.aEncoder.isEmpty =>
ta.copy(aEncoder = Some(boundEncoder), children = schema)
},
encoder)
}
}

Expand Down Expand Up @@ -691,8 +692,9 @@ class Column(protected[sql] val expr: Expression) extends Logging {
*
* @group expr_ops
* @since 1.3.0
* @deprecated As of 1.5.0. Use isin. This will be removed in Spark 2.0.
*/
@deprecated("use isin", "1.5.0")
@deprecated("use isin. This will be removed in Spark 2.0.", "1.5.0")
@scala.annotation.varargs
def in(list: Any*): Column = isin(list : _*)

Expand Down
72 changes: 46 additions & 26 deletions sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1713,9 +1713,9 @@ class DataFrame private[sql](
////////////////////////////////////////////////////////////////////////////

/**
* @deprecated As of 1.3.0, replaced by `toDF()`.
* @deprecated As of 1.3.0, replaced by `toDF()`. This will be removed in Spark 2.0.
*/
@deprecated("use toDF", "1.3.0")
@deprecated("Use toDF. This will be removed in Spark 2.0.", "1.3.0")
def toSchemaRDD: DataFrame = this

/**
Expand All @@ -1725,9 +1725,9 @@ class DataFrame private[sql](
* given name; if you pass `false`, it will throw if the table already
* exists.
* @group output
* @deprecated As of 1.340, replaced by `write().jdbc()`.
* @deprecated As of 1.340, replaced by `write().jdbc()`. This will be removed in Spark 2.0.
*/
@deprecated("Use write.jdbc()", "1.4.0")
@deprecated("Use write.jdbc(). This will be removed in Spark 2.0.", "1.4.0")
def createJDBCTable(url: String, table: String, allowExisting: Boolean): Unit = {
val w = if (allowExisting) write.mode(SaveMode.Overwrite) else write
w.jdbc(url, table, new Properties)
Expand All @@ -1744,9 +1744,9 @@ class DataFrame private[sql](
* the RDD in order via the simple statement
* `INSERT INTO table VALUES (?, ?, ..., ?)` should not fail.
* @group output
* @deprecated As of 1.4.0, replaced by `write().jdbc()`.
* @deprecated As of 1.4.0, replaced by `write().jdbc()`. This will be removed in Spark 2.0.
*/
@deprecated("Use write.jdbc()", "1.4.0")
@deprecated("Use write.jdbc(). This will be removed in Spark 2.0.", "1.4.0")
def insertIntoJDBC(url: String, table: String, overwrite: Boolean): Unit = {
val w = if (overwrite) write.mode(SaveMode.Overwrite) else write.mode(SaveMode.Append)
w.jdbc(url, table, new Properties)
Expand All @@ -1757,9 +1757,9 @@ class DataFrame private[sql](
* Files that are written out using this method can be read back in as a [[DataFrame]]
* using the `parquetFile` function in [[SQLContext]].
* @group output
* @deprecated As of 1.4.0, replaced by `write().parquet()`.
* @deprecated As of 1.4.0, replaced by `write().parquet()`. This will be removed in Spark 2.0.
*/
@deprecated("Use write.parquet(path)", "1.4.0")
@deprecated("Use write.parquet(path). This will be removed in Spark 2.0.", "1.4.0")
def saveAsParquetFile(path: String): Unit = {
write.format("parquet").mode(SaveMode.ErrorIfExists).save(path)
}
Expand All @@ -1782,8 +1782,9 @@ class DataFrame private[sql](
*
* @group output
* @deprecated As of 1.4.0, replaced by `write().saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.saveAsTable(tableName). This will be removed in Spark 2.0.", "1.4.0")
def saveAsTable(tableName: String): Unit = {
write.mode(SaveMode.ErrorIfExists).saveAsTable(tableName)
}
Expand All @@ -1805,8 +1806,10 @@ class DataFrame private[sql](
*
* @group output
* @deprecated As of 1.4.0, replaced by `write().mode(mode).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.mode(mode).saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.mode(mode).saveAsTable(tableName). This will be removed in Spark 2.0.",
"1.4.0")
def saveAsTable(tableName: String, mode: SaveMode): Unit = {
write.mode(mode).saveAsTable(tableName)
}
Expand All @@ -1829,8 +1832,10 @@ class DataFrame private[sql](
*
* @group output
* @deprecated As of 1.4.0, replaced by `write().format(source).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.format(source).saveAsTable(tableName). This will be removed in Spark 2.0.",
"1.4.0")
def saveAsTable(tableName: String, source: String): Unit = {
write.format(source).saveAsTable(tableName)
}
Expand All @@ -1853,8 +1858,10 @@ class DataFrame private[sql](
*
* @group output
* @deprecated As of 1.4.0, replaced by `write().mode(mode).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.format(source).mode(mode).saveAsTable(tableName). " +
"This will be removed in Spark 2.0.", "1.4.0")
def saveAsTable(tableName: String, source: String, mode: SaveMode): Unit = {
write.format(source).mode(mode).saveAsTable(tableName)
}
Expand All @@ -1877,9 +1884,10 @@ class DataFrame private[sql](
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().format(source).mode(mode).options(options).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName)",
"1.4.0")
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName). " +
"This will be removed in Spark 2.0.", "1.4.0")
def saveAsTable(
tableName: String,
source: String,
Expand Down Expand Up @@ -1907,9 +1915,10 @@ class DataFrame private[sql](
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().format(source).mode(mode).options(options).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName)",
"1.4.0")
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName). " +
"This will be removed in Spark 2.0.", "1.4.0")
def saveAsTable(
tableName: String,
source: String,
Expand All @@ -1923,9 +1932,9 @@ class DataFrame private[sql](
* using the default data source configured by spark.sql.sources.default and
* [[SaveMode.ErrorIfExists]] as the save mode.
* @group output
* @deprecated As of 1.4.0, replaced by `write().save(path)`.
* @deprecated As of 1.4.0, replaced by `write().save(path)`. This will be removed in Spark 2.0.
*/
@deprecated("Use write.save(path)", "1.4.0")
@deprecated("Use write.save(path). This will be removed in Spark 2.0.", "1.4.0")
def save(path: String): Unit = {
write.save(path)
}
Expand All @@ -1935,8 +1944,9 @@ class DataFrame private[sql](
* using the default data source configured by spark.sql.sources.default.
* @group output
* @deprecated As of 1.4.0, replaced by `write().mode(mode).save(path)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.mode(mode).save(path)", "1.4.0")
@deprecated("Use write.mode(mode).save(path). This will be removed in Spark 2.0.", "1.4.0")
def save(path: String, mode: SaveMode): Unit = {
write.mode(mode).save(path)
}
Expand All @@ -1946,8 +1956,9 @@ class DataFrame private[sql](
* using [[SaveMode.ErrorIfExists]] as the save mode.
* @group output
* @deprecated As of 1.4.0, replaced by `write().format(source).save(path)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).save(path)", "1.4.0")
@deprecated("Use write.format(source).save(path). This will be removed in Spark 2.0.", "1.4.0")
def save(path: String, source: String): Unit = {
write.format(source).save(path)
}
Expand All @@ -1957,8 +1968,10 @@ class DataFrame private[sql](
* [[SaveMode]] specified by mode.
* @group output
* @deprecated As of 1.4.0, replaced by `write().format(source).mode(mode).save(path)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).save(path)", "1.4.0")
@deprecated("Use write.format(source).mode(mode).save(path). " +
"This will be removed in Spark 2.0.", "1.4.0")
def save(path: String, source: String, mode: SaveMode): Unit = {
write.format(source).mode(mode).save(path)
}
Expand All @@ -1969,8 +1982,10 @@ class DataFrame private[sql](
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().format(source).mode(mode).options(options).save(path)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).options(options).save()", "1.4.0")
@deprecated("Use write.format(source).mode(mode).options(options).save(). " +
"This will be removed in Spark 2.0.", "1.4.0")
def save(
source: String,
mode: SaveMode,
Expand All @@ -1985,23 +2000,26 @@ class DataFrame private[sql](
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().format(source).mode(mode).options(options).save(path)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.format(source).mode(mode).options(options).save()", "1.4.0")
@deprecated("Use write.format(source).mode(mode).options(options).save(). " +
"This will be removed in Spark 2.0.", "1.4.0")
def save(
source: String,
mode: SaveMode,
options: Map[String, String]): Unit = {
write.format(source).mode(mode).options(options).save()
}


/**
* Adds the rows from this RDD to the specified table, optionally overwriting the existing data.
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName). " +
"This will be removed in Spark 2.0.", "1.4.0")
def insertInto(tableName: String, overwrite: Boolean): Unit = {
write.mode(if (overwrite) SaveMode.Overwrite else SaveMode.Append).insertInto(tableName)
}
Expand All @@ -2012,8 +2030,10 @@ class DataFrame private[sql](
* @group output
* @deprecated As of 1.4.0, replaced by
* `write().mode(SaveMode.Append).saveAsTable(tableName)`.
* This will be removed in Spark 2.0.
*/
@deprecated("Use write.mode(SaveMode.Append).saveAsTable(tableName)", "1.4.0")
@deprecated("Use write.mode(SaveMode.Append).saveAsTable(tableName). " +
"This will be removed in Spark 2.0.", "1.4.0")
def insertInto(tableName: String): Unit = {
write.mode(SaveMode.Append).insertInto(tableName)
}
Expand Down
1 change: 1 addition & 0 deletions sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.apache.spark.sql.execution.{Queryable, QueryExecution}
import org.apache.spark.sql.types.StructType

/**
* :: Experimental ::
* A [[Dataset]] is a strongly typed collection of objects that can be transformed in parallel
* using functional or relational operations.
*
Expand Down
Loading