-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25908][CORE][SQL] Remove old deprecated items in Spark 3 #22921
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
a6891f7
6bcbf79
af748d5
78f7ca8
3070975
9f1ced3
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 |
|---|---|---|
|
|
@@ -112,7 +112,7 @@ NULL | |
| #' df <- createDataFrame(cbind(model = rownames(mtcars), mtcars)) | ||
| #' tmp <- mutate(df, v1 = log(df$mpg), v2 = cbrt(df$disp), | ||
| #' v3 = bround(df$wt, 1), v4 = bin(df$cyl), | ||
| #' v5 = hex(df$wt), v6 = toDegrees(df$gear), | ||
| #' v5 = hex(df$wt), v6 = degrees(df$gear), | ||
| #' v7 = atan2(df$cyl, df$am), v8 = hypot(df$cyl, df$am), | ||
| #' v9 = pmod(df$hp, df$cyl), v10 = shiftLeft(df$disp, 1), | ||
| #' v11 = conv(df$hp, 10, 16), v12 = sign(df$vs - 0.5), | ||
|
|
@@ -320,23 +320,37 @@ setMethod("acos", | |
| }) | ||
|
|
||
| #' @details | ||
| #' \code{approxCountDistinct}: Returns the approximate number of distinct items in a group. | ||
| #' \code{approx_count_distinct}: Returns the approximate number of distinct items in a group. | ||
| #' | ||
| #' @rdname column_aggregate_functions | ||
| #' @aliases approxCountDistinct approxCountDistinct,Column-method | ||
| #' @aliases approx_count_distinct approx_count_distinct,Column-method | ||
| #' @examples | ||
| #' | ||
| #' \dontrun{ | ||
| #' head(select(df, approxCountDistinct(df$gear))) | ||
| #' head(select(df, approxCountDistinct(df$gear, 0.02))) | ||
| #' head(select(df, approx_count_distinct(df$gear))) | ||
| #' head(select(df, approx_count_distinct(df$gear, 0.02))) | ||
| #' head(select(df, countDistinct(df$gear, df$cyl))) | ||
| #' head(select(df, n_distinct(df$gear))) | ||
| #' head(distinct(select(df, "gear")))} | ||
| #' @note approx_count_distinct(Column) since 3.0.0 | ||
| setMethod("approx_count_distinct", | ||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approx_count_distinct", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
| #' @details | ||
| #' \code{approxCountDistinct}: Returns the approximate number of distinct items in a group. | ||
| #' | ||
| #' @rdname column_aggregate_functions | ||
| #' @aliases approxCountDistinct approxCountDistinct,Column-method | ||
| #' @note approxCountDistinct(Column) since 1.4.0 | ||
| setMethod("approxCountDistinct", | ||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approxCountDistinct", x@jc) | ||
| .Deprecated("approx_count_distinct") | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approx_count_distinct", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
|
|
@@ -1651,7 +1665,22 @@ setMethod("tanh", | |
| setMethod("toDegrees", | ||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "toDegrees", x@jc) | ||
| .Deprecated("degrees") | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "degrees", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
| #' @details | ||
| #' \code{degrees}: Converts an angle measured in radians to an approximately equivalent angle | ||
| #' measured in degrees. | ||
| #' | ||
| #' @rdname column_math_functions | ||
| #' @aliases degrees degrees,Column-method | ||
| #' @note degrees since 3.0.0 | ||
| setMethod("degrees", | ||
|
||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "degrees", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
|
|
@@ -1665,7 +1694,22 @@ setMethod("toDegrees", | |
| setMethod("toRadians", | ||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "toRadians", x@jc) | ||
| .Deprecated("radians") | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "radians", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
| #' @details | ||
| #' \code{radians}: Converts an angle measured in degrees to an approximately equivalent angle | ||
| #' measured in radians. | ||
| #' | ||
| #' @rdname column_math_functions | ||
| #' @aliases radians radians,Column-method | ||
| #' @note radians since 3.0.0 | ||
| setMethod("radians", | ||
| signature(x = "Column"), | ||
| function(x) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "radians", x@jc) | ||
| column(jc) | ||
| }) | ||
|
|
||
|
|
@@ -2065,13 +2109,24 @@ setMethod("pmod", signature(y = "Column"), | |
|
|
||
| #' @param rsd maximum estimation error allowed (default = 0.05). | ||
| #' | ||
| #' @rdname column_aggregate_functions | ||
| #' @aliases approx_count_distinct,Column-method | ||
| #' @note approx_count_distinct(Column, numeric) since 3.0.0 | ||
| setMethod("approx_count_distinct", | ||
| signature(x = "Column"), | ||
| function(x, rsd = 0.05) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approx_count_distinct", x@jc, rsd) | ||
| column(jc) | ||
| }) | ||
|
|
||
| #' @rdname column_aggregate_functions | ||
| #' @aliases approxCountDistinct,Column-method | ||
| #' @note approxCountDistinct(Column, numeric) since 1.4.0 | ||
| setMethod("approxCountDistinct", | ||
| signature(x = "Column"), | ||
| function(x, rsd = 0.05) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approxCountDistinct", x@jc, rsd) | ||
| .Deprecated("approx_count_distinct") | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "approx_count_distinct", x@jc, rsd) | ||
| column(jc) | ||
| }) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -746,6 +746,10 @@ setGeneric("windowOrderBy", function(col, ...) { standardGeneric("windowOrderBy" | |
| #' @name NULL | ||
| setGeneric("add_months", function(y, x) { standardGeneric("add_months") }) | ||
|
|
||
| #' @rdname column_aggregate_functions | ||
| #' @name NULL | ||
| setGeneric("approx_count_distinct", function(x, ...) { standardGeneric("approx_count_distinct") }) | ||
|
||
|
|
||
| #' @rdname column_aggregate_functions | ||
| #' @name NULL | ||
| setGeneric("approxCountDistinct", function(x, ...) { standardGeneric("approxCountDistinct") }) | ||
|
|
@@ -1287,10 +1291,18 @@ setGeneric("substring_index", function(x, delim, count) { standardGeneric("subst | |
| #' @name NULL | ||
| setGeneric("sumDistinct", function(x) { standardGeneric("sumDistinct") }) | ||
|
|
||
| #' @rdname column_math_functions | ||
| #' @name NULL | ||
| setGeneric("degrees", function(x) { standardGeneric("degrees") }) | ||
|
|
||
| #' @rdname column_math_functions | ||
| #' @name NULL | ||
| setGeneric("toDegrees", function(x) { standardGeneric("toDegrees") }) | ||
|
|
||
| #' @rdname column_math_functions | ||
| #' @name NULL | ||
| setGeneric("radians", function(x) { standardGeneric("radians") }) | ||
|
|
||
| #' @rdname column_math_functions | ||
| #' @name NULL | ||
| setGeneric("toRadians", function(x) { standardGeneric("toRadians") }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,18 +47,6 @@ import org.apache.spark.util.{Utils, VersionUtils} | |
| private[util] sealed trait BaseReadWrite { | ||
| private var optionSparkSession: Option[SparkSession] = None | ||
|
|
||
| /** | ||
| * Sets the Spark SQLContext to use for saving/loading. | ||
| * | ||
| * @deprecated Use session instead. This method will be removed in 3.0.0. | ||
| */ | ||
| @Since("1.6.0") | ||
| @deprecated("Use session instead. This method will be removed in 3.0.0.", "2.0.0") | ||
| def context(sqlContext: SQLContext): this.type = { | ||
| optionSparkSession = Option(sqlContext.sparkSession) | ||
| this | ||
| } | ||
|
|
||
| /** | ||
| * Sets the Spark Session to use for saving/loading. | ||
| */ | ||
|
|
@@ -215,10 +203,6 @@ abstract class MLWriter extends BaseReadWrite with Logging { | |
| // override for Java compatibility | ||
| @Since("1.6.0") | ||
| override def session(sparkSession: SparkSession): this.type = super.session(sparkSession) | ||
|
|
||
| // override for Java compatibility | ||
| @Since("1.6.0") | ||
| override def context(sqlContext: SQLContext): this.type = super.session(sqlContext.sparkSession) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -281,9 +265,6 @@ class GeneralMLWriter(stage: PipelineStage) extends MLWriter with Logging { | |
|
|
||
| // override for Java compatibility | ||
| override def session(sparkSession: SparkSession): this.type = super.session(sparkSession) | ||
|
|
||
| // override for Java compatibility | ||
| override def context(sqlContext: SQLContext): this.type = super.session(sqlContext.sparkSession) | ||
|
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. @srowen This public method seems had not been deprecated before removal, and is avaiable in 2.4.5. There is no deprecation warning above. Does it matter?
Member
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. This seems properly deprecated in
Member
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 it was deprecated in 2.0.0 and marked for removal in 3.0.0. I think ideally the Java overload and subclass overrides would be marked deprecated too, but they implicitly are. If there were a case that this is actually used, we could revive it, but just wondering how often people would be using save + 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. I never use this method, just check it. Thanks! |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -352,9 +333,6 @@ abstract class MLReader[T] extends BaseReadWrite { | |
|
|
||
| // override for Java compatibility | ||
| override def session(sparkSession: SparkSession): this.type = super.session(sparkSession) | ||
|
|
||
| // override for Java compatibility | ||
| override def context(sqlContext: SQLContext): this.type = super.session(sqlContext.sparkSession) | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
we only need one set - they both are
@rdname column_aggregate_functionsso will duplicate all other examplesThere 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.
Thanks, @HyukjinKwon fixed this. Pending tests, does the change look OK to you on the R side @felixcheung ?