Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Oct 23, 2017

What changes were proposed in this pull request?

Scala 2.12's Future defines two new methods to implement, transform and transformWith. These can be implemented naturally in Spark's FutureAction extension and subclasses, but, only in terms of the new methods that don't exist in Scala 2.11. To support both at the same time, reflection is used to implement these.

How was this patch tested?

Existing tests.

…mpatbility, while retaining 2.11 comptability
*/
private[spark] object FutureAction {

private val transformTryMethod =
Copy link
Member Author

Choose a reason for hiding this comment

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

Having to access this by reflection is a little annoying but keeping 2.11 + 2.12 compatibility in one source file is nice, and doesn't entail much of any runtime overhead

<id>scala-2.12</id>
<properties>
<scala.version>2.12.3</scala.version>
<scala.version>2.12.4</scala.version>
Copy link
Member Author

Choose a reason for hiding this comment

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

This update picks up a fix for another scalac bug that also prevents the 2.12 build from working, but, has no effect on 2.11

}
}
AwaitTerminationTester.test(expectedBehavior, awaitTermFunc)
AwaitTerminationTester.test(expectedBehavior, () => awaitTermFunc())
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 rest here are just 2.12 warning cleanups by the by

// and then filled in with a real implementation in the two subclasses below. The no-op exists
// here so that those implementations can declare "override", necessary in 2.12, while working
// in 2.11, where the method doesn't exist in the superclass.
// After 2.11 support goes away, remove these two:
Copy link
Member Author

Choose a reason for hiding this comment

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

In case it wasn't clear, this change ought to have no effect at all in 2.11

@SparkQA
Copy link

SparkQA commented Oct 23, 2017

Test build #82991 has finished for PR 19561 at commit faa6754.

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

@srowen
Copy link
Member Author

srowen commented Oct 25, 2017

Merged to master

srowen added a commit to srowen/spark that referenced this pull request Oct 25, 2017
…2.12 Future

## What changes were proposed in this pull request?

Scala 2.12's `Future` defines two new methods to implement, `transform` and `transformWith`. These can be implemented naturally in Spark's `FutureAction` extension and subclasses, but, only in terms of the new methods that don't exist in Scala 2.11. To support both at the same time, reflection is used to implement these.

## How was this patch tested?

Existing tests.

Author: Sean Owen <sowen@cloudera.com>

Closes apache#19561 from srowen/SPARK-22322.
@srowen srowen closed this Oct 25, 2017
@srowen srowen deleted the SPARK-22322 branch October 25, 2017 11:51
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.

2 participants