Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Nov 17, 2018

What changes were proposed in this pull request?

The build has a lot of deprecation warnings. Some are new in Scala 2.12 and Java 11. We've fixed some, but I wanted to take a pass at fixing lots of easy miscellaneous ones here.

They're too numerous and small to list here; see the pull request. Some highlights:

  • @BeanInfo is deprecated in 2.12, and BeanInfo classes are pretty ancient in Java. Instead, case classes can explicitly declare getters
  • Eta expansion of zero-arg methods; foo() becomes () => foo() in many cases
  • Floating-point Range is inexact and deprecated, like 0.0 to 100.0 by 1.0
  • finalize() is finally deprecated (just needs to be suppressed)
  • StageInfo.attempId was deprecated and easiest to remove here

I'm not now going to touch some chunks of deprecation warnings:

  • Parquet deprecations
  • Hive deprecations (particularly serde2 classes)
  • Deprecations in generated code (mostly Thriftserver CLI)
  • ProcessingTime deprecations (we may need to revive this class as internal)
  • many MLlib deprecations because they concern methods that may be removed anyway
  • a few Kinesis deprecations I couldn't figure out
  • Mesos get/setRole, which I don't know well
  • Kafka/ZK deprecations (e.g. poll())
  • Kinesis
  • a few other ones that will probably resolve by deleting a deprecated method

How was this patch tested?

Existing tests, including manual testing with the 2.11 build and Java 11.

Copy link
Member Author

Choose a reason for hiding this comment

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

LevenshteinDistance moved here from commons lang

Copy link
Member Author

Choose a reason for hiding this comment

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

Funny, MiMa didn't warn about this, but will go in release notes

Copy link
Member Author

Choose a reason for hiding this comment

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

Complains about existential types if you access a method in an anonymous inner class

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be an exact workalike invocation here, just works around a deprecation

Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the Kinesis changes are of this form, to use the new client builder, with the same argument going in as far as I can tell. The rest are Java 8 cleanups.

Copy link
Member Author

Choose a reason for hiding this comment

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

These assertions were wrong in two ways: == and assert

Copy link
Member Author

Choose a reason for hiding this comment

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

These are added to explicitly add what the companion BeanInfo class was implicitly adding

Copy link
Member Author

Choose a reason for hiding this comment

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

Interestingly, avoiding double Ranges actually fixed the code here. You can see the bucketing before didn't quite make sense. Now it's even. It's because of...

scala> (0.0 to 1.0 by 1.0 / 10).toList
<console>:12: warning: method to in trait FractionalProxy is deprecated (since 2.12.6): use BigDecimal range instead
       (0.0 to 1.0 by 1.0 / 10).toList
            ^
res5: List[Double] = List(0.0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6, 0.7, 0.7999999999999999, 0.8999999999999999, 0.9999999999999999)

scala> (0 to 10).map(_.toDouble / 10).toList
res6: List[Double] = List(0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.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.

The filter here was nonsensical, comparing a value to type. Removed it as it's always true

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is the recommended way to get a concurrent Set in the JDK

@SparkQA
Copy link

SparkQA commented Nov 17, 2018

Test build #98948 has finished for PR 23065 at commit e2e375b.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 17, 2018

Test build #4429 has finished for PR 23065 at commit e2e375b.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 18, 2018

Test build #98972 has finished for PR 23065 at commit 4665696.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member Author

srowen commented Nov 18, 2018

Hm, Kinesis tests are failing. They pass locally when I set my credentials and enable the tests. They also seem to pass on Jenkins, like on this recent PR: https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/4432/testReport/org.apache.spark.streaming.kinesis/

Clearly it's something to do with my changes, but not sure what, as they seem to work locally. If I can't figure it out after another guess I'll back out the kinesis changes.

@SparkQA
Copy link

SparkQA commented Nov 18, 2018

Test build #98983 has finished for PR 23065 at commit 0cfcd90.

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

@gengliangwang
Copy link
Member

Hi @srowen ,
Could you review and merge srowen#4 ?
I see a lot of warnings as well. We should fix them.

@srowen
Copy link
Member Author

srowen commented Nov 19, 2018

@gengliangwang that will fail in Scala 2.11; can't do it unfortunately.

@gengliangwang
Copy link
Member

gengliangwang commented Nov 19, 2018

@srowen you are right. It will failed in the SQL module.

@srowen
Copy link
Member Author

srowen commented Nov 19, 2018

Merged to master

Copy link
Member

@gengliangwang gengliangwang left a comment

Choose a reason for hiding this comment

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

LGTM.

@asfgit asfgit closed this in 32365f8 Nov 20, 2018
@srowen srowen deleted the SPARK-26090 branch November 26, 2018 13:15
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…nd build warnings for Spark 3

## What changes were proposed in this pull request?

The build has a lot of deprecation warnings. Some are new in Scala 2.12 and Java 11. We've fixed some, but I wanted to take a pass at fixing lots of easy miscellaneous ones here.

They're too numerous and small to list here; see the pull request. Some highlights:

- `BeanInfo` is deprecated in 2.12, and BeanInfo classes are pretty ancient in Java. Instead, case classes can explicitly declare getters
- Eta expansion of zero-arg methods; foo() becomes () => foo() in many cases
- Floating-point Range is inexact and deprecated, like 0.0 to 100.0 by 1.0
- finalize() is finally deprecated (just needs to be suppressed)
- StageInfo.attempId was deprecated and easiest to remove here

I'm not now going to touch some chunks of deprecation warnings:

- Parquet deprecations
- Hive deprecations (particularly serde2 classes)
- Deprecations in generated code (mostly Thriftserver CLI)
- ProcessingTime deprecations (we may need to revive this class as internal)
- many MLlib deprecations because they concern methods that may be removed anyway
- a few Kinesis deprecations I couldn't figure out
- Mesos get/setRole, which I don't know well
- Kafka/ZK deprecations (e.g. poll())
- Kinesis
- a few other ones that will probably resolve by deleting a deprecated method

## How was this patch tested?

Existing tests, including manual testing with the 2.11 build and Java 11.

Closes apache#23065 from srowen/SPARK-26090.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants