Skip to content

Commit 4d6bbbc

Browse files
committed
[SPARK-11947][SQL] Mark deprecated methods with "This will be removed in Spark 2.0."
Also fixed some documentation as I saw them. Author: Reynold Xin <[email protected]> Closes #9930 from rxin/SPARK-11947.
1 parent 25bbd3c commit 4d6bbbc

File tree

9 files changed

+172
-110
lines changed

9 files changed

+172
-110
lines changed

project/MimaExcludes.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ object MimaExcludes {
108108
ProblemFilters.exclude[MissingClassProblem](
109109
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD"),
110110
ProblemFilters.exclude[MissingClassProblem](
111-
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD$")
111+
"org.apache.spark.rdd.MapPartitionsWithPreparationRDD$"),
112+
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.sql.SparkSQLParser")
112113
) ++ Seq(
113114
// SPARK-11485
114115
ProblemFilters.exclude[MissingMethodProblem]("org.apache.spark.sql.DataFrameHolder.df"),

sql/core/src/main/scala/org/apache/spark/sql/Column.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ private[sql] object Column {
4242

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

5658
/**
5759
* Inserts the specific input type and schema into any expressions that are expected to operate
@@ -61,12 +63,11 @@ class TypedColumn[-T, U](
6163
inputEncoder: ExpressionEncoder[_],
6264
schema: Seq[Attribute]): TypedColumn[T, U] = {
6365
val boundEncoder = inputEncoder.bind(schema).asInstanceOf[ExpressionEncoder[Any]]
64-
new TypedColumn[T, U] (expr transform {
65-
case ta: TypedAggregateExpression if ta.aEncoder.isEmpty =>
66-
ta.copy(
67-
aEncoder = Some(boundEncoder),
68-
children = schema)
69-
}, encoder)
66+
new TypedColumn[T, U](
67+
expr transform { case ta: TypedAggregateExpression if ta.aEncoder.isEmpty =>
68+
ta.copy(aEncoder = Some(boundEncoder), children = schema)
69+
},
70+
encoder)
7071
}
7172
}
7273

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

sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,9 +1713,9 @@ class DataFrame private[sql](
17131713
////////////////////////////////////////////////////////////////////////////
17141714

17151715
/**
1716-
* @deprecated As of 1.3.0, replaced by `toDF()`.
1716+
* @deprecated As of 1.3.0, replaced by `toDF()`. This will be removed in Spark 2.0.
17171717
*/
1718-
@deprecated("use toDF", "1.3.0")
1718+
@deprecated("Use toDF. This will be removed in Spark 2.0.", "1.3.0")
17191719
def toSchemaRDD: DataFrame = this
17201720

17211721
/**
@@ -1725,9 +1725,9 @@ class DataFrame private[sql](
17251725
* given name; if you pass `false`, it will throw if the table already
17261726
* exists.
17271727
* @group output
1728-
* @deprecated As of 1.340, replaced by `write().jdbc()`.
1728+
* @deprecated As of 1.340, replaced by `write().jdbc()`. This will be removed in Spark 2.0.
17291729
*/
1730-
@deprecated("Use write.jdbc()", "1.4.0")
1730+
@deprecated("Use write.jdbc(). This will be removed in Spark 2.0.", "1.4.0")
17311731
def createJDBCTable(url: String, table: String, allowExisting: Boolean): Unit = {
17321732
val w = if (allowExisting) write.mode(SaveMode.Overwrite) else write
17331733
w.jdbc(url, table, new Properties)
@@ -1744,9 +1744,9 @@ class DataFrame private[sql](
17441744
* the RDD in order via the simple statement
17451745
* `INSERT INTO table VALUES (?, ?, ..., ?)` should not fail.
17461746
* @group output
1747-
* @deprecated As of 1.4.0, replaced by `write().jdbc()`.
1747+
* @deprecated As of 1.4.0, replaced by `write().jdbc()`. This will be removed in Spark 2.0.
17481748
*/
1749-
@deprecated("Use write.jdbc()", "1.4.0")
1749+
@deprecated("Use write.jdbc(). This will be removed in Spark 2.0.", "1.4.0")
17501750
def insertIntoJDBC(url: String, table: String, overwrite: Boolean): Unit = {
17511751
val w = if (overwrite) write.mode(SaveMode.Overwrite) else write.mode(SaveMode.Append)
17521752
w.jdbc(url, table, new Properties)
@@ -1757,9 +1757,9 @@ class DataFrame private[sql](
17571757
* Files that are written out using this method can be read back in as a [[DataFrame]]
17581758
* using the `parquetFile` function in [[SQLContext]].
17591759
* @group output
1760-
* @deprecated As of 1.4.0, replaced by `write().parquet()`.
1760+
* @deprecated As of 1.4.0, replaced by `write().parquet()`. This will be removed in Spark 2.0.
17611761
*/
1762-
@deprecated("Use write.parquet(path)", "1.4.0")
1762+
@deprecated("Use write.parquet(path). This will be removed in Spark 2.0.", "1.4.0")
17631763
def saveAsParquetFile(path: String): Unit = {
17641764
write.format("parquet").mode(SaveMode.ErrorIfExists).save(path)
17651765
}
@@ -1782,8 +1782,9 @@ class DataFrame private[sql](
17821782
*
17831783
* @group output
17841784
* @deprecated As of 1.4.0, replaced by `write().saveAsTable(tableName)`.
1785+
* This will be removed in Spark 2.0.
17851786
*/
1786-
@deprecated("Use write.saveAsTable(tableName)", "1.4.0")
1787+
@deprecated("Use write.saveAsTable(tableName). This will be removed in Spark 2.0.", "1.4.0")
17871788
def saveAsTable(tableName: String): Unit = {
17881789
write.mode(SaveMode.ErrorIfExists).saveAsTable(tableName)
17891790
}
@@ -1805,8 +1806,10 @@ class DataFrame private[sql](
18051806
*
18061807
* @group output
18071808
* @deprecated As of 1.4.0, replaced by `write().mode(mode).saveAsTable(tableName)`.
1809+
* This will be removed in Spark 2.0.
18081810
*/
1809-
@deprecated("Use write.mode(mode).saveAsTable(tableName)", "1.4.0")
1811+
@deprecated("Use write.mode(mode).saveAsTable(tableName). This will be removed in Spark 2.0.",
1812+
"1.4.0")
18101813
def saveAsTable(tableName: String, mode: SaveMode): Unit = {
18111814
write.mode(mode).saveAsTable(tableName)
18121815
}
@@ -1829,8 +1832,10 @@ class DataFrame private[sql](
18291832
*
18301833
* @group output
18311834
* @deprecated As of 1.4.0, replaced by `write().format(source).saveAsTable(tableName)`.
1835+
* This will be removed in Spark 2.0.
18321836
*/
1833-
@deprecated("Use write.format(source).saveAsTable(tableName)", "1.4.0")
1837+
@deprecated("Use write.format(source).saveAsTable(tableName). This will be removed in Spark 2.0.",
1838+
"1.4.0")
18341839
def saveAsTable(tableName: String, source: String): Unit = {
18351840
write.format(source).saveAsTable(tableName)
18361841
}
@@ -1853,8 +1858,10 @@ class DataFrame private[sql](
18531858
*
18541859
* @group output
18551860
* @deprecated As of 1.4.0, replaced by `write().mode(mode).saveAsTable(tableName)`.
1861+
* This will be removed in Spark 2.0.
18561862
*/
1857-
@deprecated("Use write.format(source).mode(mode).saveAsTable(tableName)", "1.4.0")
1863+
@deprecated("Use write.format(source).mode(mode).saveAsTable(tableName). " +
1864+
"This will be removed in Spark 2.0.", "1.4.0")
18581865
def saveAsTable(tableName: String, source: String, mode: SaveMode): Unit = {
18591866
write.format(source).mode(mode).saveAsTable(tableName)
18601867
}
@@ -1877,9 +1884,10 @@ class DataFrame private[sql](
18771884
* @group output
18781885
* @deprecated As of 1.4.0, replaced by
18791886
* `write().format(source).mode(mode).options(options).saveAsTable(tableName)`.
1887+
* This will be removed in Spark 2.0.
18801888
*/
1881-
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName)",
1882-
"1.4.0")
1889+
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName). " +
1890+
"This will be removed in Spark 2.0.", "1.4.0")
18831891
def saveAsTable(
18841892
tableName: String,
18851893
source: String,
@@ -1907,9 +1915,10 @@ class DataFrame private[sql](
19071915
* @group output
19081916
* @deprecated As of 1.4.0, replaced by
19091917
* `write().format(source).mode(mode).options(options).saveAsTable(tableName)`.
1918+
* This will be removed in Spark 2.0.
19101919
*/
1911-
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName)",
1912-
"1.4.0")
1920+
@deprecated("Use write.format(source).mode(mode).options(options).saveAsTable(tableName). " +
1921+
"This will be removed in Spark 2.0.", "1.4.0")
19131922
def saveAsTable(
19141923
tableName: String,
19151924
source: String,
@@ -1923,9 +1932,9 @@ class DataFrame private[sql](
19231932
* using the default data source configured by spark.sql.sources.default and
19241933
* [[SaveMode.ErrorIfExists]] as the save mode.
19251934
* @group output
1926-
* @deprecated As of 1.4.0, replaced by `write().save(path)`.
1935+
* @deprecated As of 1.4.0, replaced by `write().save(path)`. This will be removed in Spark 2.0.
19271936
*/
1928-
@deprecated("Use write.save(path)", "1.4.0")
1937+
@deprecated("Use write.save(path). This will be removed in Spark 2.0.", "1.4.0")
19291938
def save(path: String): Unit = {
19301939
write.save(path)
19311940
}
@@ -1935,8 +1944,9 @@ class DataFrame private[sql](
19351944
* using the default data source configured by spark.sql.sources.default.
19361945
* @group output
19371946
* @deprecated As of 1.4.0, replaced by `write().mode(mode).save(path)`.
1947+
* This will be removed in Spark 2.0.
19381948
*/
1939-
@deprecated("Use write.mode(mode).save(path)", "1.4.0")
1949+
@deprecated("Use write.mode(mode).save(path). This will be removed in Spark 2.0.", "1.4.0")
19401950
def save(path: String, mode: SaveMode): Unit = {
19411951
write.mode(mode).save(path)
19421952
}
@@ -1946,8 +1956,9 @@ class DataFrame private[sql](
19461956
* using [[SaveMode.ErrorIfExists]] as the save mode.
19471957
* @group output
19481958
* @deprecated As of 1.4.0, replaced by `write().format(source).save(path)`.
1959+
* This will be removed in Spark 2.0.
19491960
*/
1950-
@deprecated("Use write.format(source).save(path)", "1.4.0")
1961+
@deprecated("Use write.format(source).save(path). This will be removed in Spark 2.0.", "1.4.0")
19511962
def save(path: String, source: String): Unit = {
19521963
write.format(source).save(path)
19531964
}
@@ -1957,8 +1968,10 @@ class DataFrame private[sql](
19571968
* [[SaveMode]] specified by mode.
19581969
* @group output
19591970
* @deprecated As of 1.4.0, replaced by `write().format(source).mode(mode).save(path)`.
1971+
* This will be removed in Spark 2.0.
19601972
*/
1961-
@deprecated("Use write.format(source).mode(mode).save(path)", "1.4.0")
1973+
@deprecated("Use write.format(source).mode(mode).save(path). " +
1974+
"This will be removed in Spark 2.0.", "1.4.0")
19621975
def save(path: String, source: String, mode: SaveMode): Unit = {
19631976
write.format(source).mode(mode).save(path)
19641977
}
@@ -1969,8 +1982,10 @@ class DataFrame private[sql](
19691982
* @group output
19701983
* @deprecated As of 1.4.0, replaced by
19711984
* `write().format(source).mode(mode).options(options).save(path)`.
1985+
* This will be removed in Spark 2.0.
19721986
*/
1973-
@deprecated("Use write.format(source).mode(mode).options(options).save()", "1.4.0")
1987+
@deprecated("Use write.format(source).mode(mode).options(options).save(). " +
1988+
"This will be removed in Spark 2.0.", "1.4.0")
19741989
def save(
19751990
source: String,
19761991
mode: SaveMode,
@@ -1985,23 +2000,26 @@ class DataFrame private[sql](
19852000
* @group output
19862001
* @deprecated As of 1.4.0, replaced by
19872002
* `write().format(source).mode(mode).options(options).save(path)`.
2003+
* This will be removed in Spark 2.0.
19882004
*/
1989-
@deprecated("Use write.format(source).mode(mode).options(options).save()", "1.4.0")
2005+
@deprecated("Use write.format(source).mode(mode).options(options).save(). " +
2006+
"This will be removed in Spark 2.0.", "1.4.0")
19902007
def save(
19912008
source: String,
19922009
mode: SaveMode,
19932010
options: Map[String, String]): Unit = {
19942011
write.format(source).mode(mode).options(options).save()
19952012
}
19962013

1997-
19982014
/**
19992015
* Adds the rows from this RDD to the specified table, optionally overwriting the existing data.
20002016
* @group output
20012017
* @deprecated As of 1.4.0, replaced by
20022018
* `write().mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName)`.
2019+
* This will be removed in Spark 2.0.
20032020
*/
2004-
@deprecated("Use write.mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName)", "1.4.0")
2021+
@deprecated("Use write.mode(SaveMode.Append|SaveMode.Overwrite).saveAsTable(tableName). " +
2022+
"This will be removed in Spark 2.0.", "1.4.0")
20052023
def insertInto(tableName: String, overwrite: Boolean): Unit = {
20062024
write.mode(if (overwrite) SaveMode.Overwrite else SaveMode.Append).insertInto(tableName)
20072025
}
@@ -2012,8 +2030,10 @@ class DataFrame private[sql](
20122030
* @group output
20132031
* @deprecated As of 1.4.0, replaced by
20142032
* `write().mode(SaveMode.Append).saveAsTable(tableName)`.
2033+
* This will be removed in Spark 2.0.
20152034
*/
2016-
@deprecated("Use write.mode(SaveMode.Append).saveAsTable(tableName)", "1.4.0")
2035+
@deprecated("Use write.mode(SaveMode.Append).saveAsTable(tableName). " +
2036+
"This will be removed in Spark 2.0.", "1.4.0")
20172037
def insertInto(tableName: String): Unit = {
20182038
write.mode(SaveMode.Append).insertInto(tableName)
20192039
}

sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.apache.spark.sql.execution.{Queryable, QueryExecution}
3232
import org.apache.spark.sql.types.StructType
3333

3434
/**
35+
* :: Experimental ::
3536
* A [[Dataset]] is a strongly typed collection of objects that can be transformed in parallel
3637
* using functional or relational operations.
3738
*

0 commit comments

Comments
 (0)