Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Sep 4, 2019

What changes were proposed in this pull request?

  • Remove SQLContext.createExternalTable and Catalog.createExternalTable, deprecated in favor of createTable since 2.2.0, plus tests of deprecated methods
  • Remove HiveContext, deprecated in 2.0.0, in favor of SparkSession.builder.enableHiveSupport
  • Remove deprecated KinesisUtils.createStream methods, plus tests of deprecated methods, deprecate in 2.2.0
  • Remove deprecated MLlib (not Spark ML) linear method support, mostly utility constructors and 'train' methods, and associated docs. This includes methods in LinearRegression, LogisticRegression, Lasso, RidgeRegression. These have been deprecated since 2.0.0
  • Remove deprecated Pyspark MLlib linear method support, including LogisticRegressionWithSGD, LinearRegressionWithSGD, LassoWithSGD
  • Remove 'runs' argument in KMeans.train() method, which has been a no-op since 2.0.0
  • Remove deprecated ChiSqSelector isSorted protected method
  • Remove deprecated 'yarn-cluster' and 'yarn-client' master argument in favor of 'yarn' and deploy mode 'cluster', etc

Notes:

  • I was not able to remove deprecated DataFrameReader.json(RDD) in favor of DataFrameReader.json(Dataset); the former was deprecated in 2.2.0, but, it is still needed to support Pyspark's .json() method, which can't use a Dataset.
  • Looks like SQLContext.createExternalTable was not actually deprecated in Pyspark, but, almost certainly was meant to be? Catalog.createExternalTable was.
  • I afterwards noted that the toDegrees, toRadians functions were almost removed fully in SPARK-25908, but Felix suggested keeping just the R version as they hadn't been technically deprecated. I'd like to revisit that. Do we really want the inconsistency? I'm not against reverting it again, but then that implies leaving SQLContext.createExternalTable just in Pyspark too, which seems weird.
  • I kept LogisticRegressionWithSGD, LinearRegressionWithSGD, LassoWithSGD, RidgeRegressionWithSGD in Pyspark, though deprecated, as it is hard to remove them (still used by StreamingLogisticRegressionWithSGD?) and they are not fully removed in Scala. Maybe should not have been deprecated.

Why are the changes needed?

Deprecated items are easiest to remove in a major release, so we should do so as much as possible for Spark 3. This does not target items deprecated 'recently' as of Spark 2.3, which is still 18 months old.

Does this PR introduce any user-facing change?

Yes, in that deprecated items are removed from some public APIs.

How was this patch tested?

Existing tests.

Copy link
Member Author

@srowen srowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a big change. But the PR description should summarize the key logical parts of the change and help understand the major pieces. There are only about 5 major removals here, they just touch a lot of files.

"sumDistinct",
"tan",
"tanh",
"toDegrees",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixcheung to comment on whether we should revisit going ahead and removing these in Spark 3 anyway. We had previously removed them in Pyspark, Scala and kept them in R.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they were deprecated eg. .Deprecated("degrees") in code, I'm ok with removing them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Deprecated was just added recently though:
https://github.com/apache/spark/pull/22921/files
This was the previous thread:
#22921 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah then I"m less sure if we have never release with the deprecation before and go straight to remove
#22921 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I see the argument @felixcheung . I reopened it because we have a similar situation with SQLContext.createExternalTable, which was deprecated everywhere but Pyspark. Presumably it was also just an oversight. Looks like we're going to remove that. I'd moderately prefer to remove these for consistency, both in the decision and w.r.t. the toDegrees method. Is that persuasive? If you feel fairly strongly about keeping it deprecated, that's OK and I can revert this part.

Copy link
Member

@felixcheung felixcheung Sep 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with it. I'd prefer we deprecate it first though. Is there going to be 2.4.5 before 3.0?

(I generally would prefer use friendliness - ie. don't break code - than consistency, as not all language API are consistent, esp. some methods are language specific, and with R is always lagging behind...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prob, I reverted this part of the change.

}
}

if (contains("spark.master") && get("spark.master").startsWith("yarn-")) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanzin may be interested in the parts that remove support for yarn-client and yarn-cluster masters.

* numIterations: 100, regParm: 0.01, miniBatchFraction: 1.0}.
*/
@Since("0.8.0")
@deprecated("Use ml.classification.LogisticRegression or LogisticRegressionWithLBFGS", "2.0.0")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if @jkbradley or @mengxr want to review the removal of MLlib deprecated items, but these have been deprecated a while.

@SparkQA

This comment has been minimized.

@SparkQA

This comment has been minimized.

@cloud-fan
Copy link
Contributor

the SQL part LGTM. I think SQLContext.createExternalTable was meant to be deprecated.

@gaborgsomogyi
Copy link
Contributor

The Kinesis part LGTM, though as @srowen mentioned not sure who is interested in.

@srowen
Copy link
Member Author

srowen commented Sep 5, 2019

I added removal of HiveContext -- let's see how this goes with tests. I think that's not controversial?

@SparkQA

This comment has been minimized.

@SparkQA

This comment has been minimized.

@HyukjinKwon
Copy link
Member

I support this PR. Well, I would even support to remove APIs deprecated as of 2.3.0 but can be done separately - I suspect that might be controversial.

cls.hive_available = True
cls.spark = None
try:
cls.sc._jvm.org.apache.hadoop.hive.conf.HiveConf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen, seems this code is still needed. SparkSession.builder.enableHiveSupport().getOrCreate() seems not able to directly check if Hive is available or not. I manually tested and just pushed the changes directly into your branch.

lambda: ImageSchema.toImage("a"))


class ImageFileFormatOnHiveContextTest(PySparkTestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen, this was removed (see #25684 (comment))

@SparkQA

This comment has been minimized.

@SparkQA

This comment has been minimized.

@SparkQA

This comment has been minimized.

@SparkQA

This comment has been minimized.

@srowen
Copy link
Member Author

srowen commented Sep 6, 2019

Thanks @HyukjinKwon ! Looks like we're in good shape. I will leave it open for a bit, pending one more item about R toDegrees above.

@SparkQA

This comment has been minimized.

@srowen
Copy link
Member Author

srowen commented Sep 9, 2019

Oops, thanks @HyukjinKwon for restoring the commits I lost. I forgot to pull and just rebased on master

@SparkQA
Copy link

SparkQA commented Sep 9, 2019

Test build #110344 has finished for PR 25684 at commit 92da887.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen srowen closed this in 6378d4b Sep 9, 2019
@srowen
Copy link
Member Author

srowen commented Sep 9, 2019

Merged to master

PavithraRamachandran pushed a commit to PavithraRamachandran/spark that referenced this pull request Sep 15, 2019
…ed in Spark 2.2.0 or earlier, for Spark 3

### What changes were proposed in this pull request?

- Remove SQLContext.createExternalTable and Catalog.createExternalTable, deprecated in favor of createTable since 2.2.0, plus tests of deprecated methods
- Remove HiveContext, deprecated in 2.0.0, in favor of `SparkSession.builder.enableHiveSupport`
- Remove deprecated KinesisUtils.createStream methods, plus tests of deprecated methods, deprecate in 2.2.0
- Remove deprecated MLlib (not Spark ML) linear method support, mostly utility constructors and 'train' methods, and associated docs. This includes methods in LinearRegression, LogisticRegression, Lasso, RidgeRegression. These have been deprecated since 2.0.0
- Remove deprecated Pyspark MLlib linear method support, including LogisticRegressionWithSGD, LinearRegressionWithSGD, LassoWithSGD
- Remove 'runs' argument in KMeans.train() method, which has been a no-op since 2.0.0
- Remove deprecated ChiSqSelector isSorted protected method
- Remove deprecated 'yarn-cluster' and 'yarn-client' master argument in favor of 'yarn' and deploy mode 'cluster', etc

Notes:

- I was not able to remove deprecated DataFrameReader.json(RDD) in favor of DataFrameReader.json(Dataset); the former was deprecated in 2.2.0, but, it is still needed to support Pyspark's .json() method, which can't use a Dataset.
- Looks like SQLContext.createExternalTable was not actually deprecated in Pyspark, but, almost certainly was meant to be? Catalog.createExternalTable was.
- I afterwards noted that the toDegrees, toRadians functions were almost removed fully in SPARK-25908, but Felix suggested keeping just the R version as they hadn't been technically deprecated. I'd like to revisit that. Do we really want the inconsistency? I'm not against reverting it again, but then that implies leaving SQLContext.createExternalTable just in Pyspark too, which seems weird.
- I *kept* LogisticRegressionWithSGD, LinearRegressionWithSGD, LassoWithSGD, RidgeRegressionWithSGD in Pyspark, though deprecated, as it is hard to remove them (still used by StreamingLogisticRegressionWithSGD?) and they are not fully removed in Scala. Maybe should not have been deprecated.

### Why are the changes needed?

Deprecated items are easiest to remove in a major release, so we should do so as much as possible for Spark 3. This does not target items deprecated 'recently' as of Spark 2.3, which is still 18 months old.

### Does this PR introduce any user-facing change?

Yes, in that deprecated items are removed from some public APIs.

### How was this patch tested?

Existing tests.

Closes apache#25684 from srowen/SPARK-28980.

Lead-authored-by: Sean Owen <[email protected]>
Co-authored-by: HyukjinKwon <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
@srowen srowen deleted the SPARK-28980 branch September 27, 2019 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants