[
https://issues.apache.org/jira/browse/SPARK-27323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dongjoon Hyun resolved SPARK-27323.
-----------------------------------
Resolution: Fixed
Fix Version/s: 3.0.0
This is resolved via https://github.com/apache/spark/pull/24241
> Use Single-Abstract-Method support in Scala 2.12 to simplify code
> -----------------------------------------------------------------
>
> Key: SPARK-27323
> URL: https://issues.apache.org/jira/browse/SPARK-27323
> Project: Spark
> Issue Type: Improvement
> Components: GraphX, Spark Core, SQL, Structured Streaming
> Affects Versions: 3.0.0
> Reporter: Sean Owen
> Assignee: Sean Owen
> Priority: Minor
> Fix For: 3.0.0
>
>
> Scala 2.12 supports Single Abstract Method (SAM) syntax like Java 8. Using
> this would lightly simplify a lot of code where we define an anonymous inner
> class. E.g.
> {code}
> private[sql] val ordering = new Ordering[InternalType] {
> override def compare(x: Array[Byte], y: Array[Byte]): Int = {
> TypeUtils.compareBinary(x, y)
> }
> }
> {code}
> becomes:
> {code}
> private[sql] val ordering = (x: Array[Byte], y: Array[Byte]) =>
> TypeUtils.compareBinary(x, y)
> {code}
> There's a small improvement to readability, and probably a tiny benefit at
> runtime as these become lambdas in the JVM, not inner classes that have to be
> compiled and instantiated. (There's also a very small reduction in the chance
> that those inner classes are accidentally holding references to things we
> don't want them to.)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]