Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented May 11, 2019

What changes were proposed in this pull request?

This removes usage of Traversable, which is removed in Scala 2.13. This is mostly an internal change, except for the change in the SparkConf.setAll method. See additional comments below.

How was this patch tested?

Existing tests.

@srowen srowen self-assigned this May 11, 2019
}

/** Set multiple parameters together */
def setAll(settings: Iterable[(String, String)]): SparkConf = {
Copy link
Member Author

Choose a reason for hiding this comment

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

Any caller is almost certainly passing an object that is Iterable as well as Traversable, but this maintains binary compatibility for now.

case e: ExprValue => transform(e)
case Some(value) => Some(doTransform(value))
case seq: Traversable[_] => seq.map(doTransform)
case seq: Iterable[_] => seq.map(doTransform)
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 is the only part of the change that is of concern. It's internal, but this now only matches Iterable and not Traversable, which are not the same in Scala 2.12. However, AFAICT, no standard class we'd expect here doesn't extend Iterable. See https://docs.scala-lang.org/overviews/collections/overview.html ; Seq, Set and Map are also Iterable already. This shouldn't change behavior, but tests will help prove that.

@beliefer
Copy link
Contributor

The internal change is easy to understand.

@SparkQA
Copy link

SparkQA commented May 11, 2019

Test build #105327 has finished for PR 24584 at commit fd3f46f.

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

@srowen
Copy link
Member Author

srowen commented May 11, 2019

BTW we have a bigger related issue: TraversableOnce -> IterableOnce. This is much more widely used and in some key APIs. I may break that one out separately into a new JIRA.

/**
* Set multiple parameters together
*/
@deprecated("Use setAll(Iterable) instead", "3.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.

Hm, is it even worth keeping and deprecating this and removing it later? It'll be source compatible already and binary compatibility isn't guaranteed; one would have to go out of one's way to call the deprecated method at all, with a cast or with some odd custom collection

Copy link
Member Author

Choose a reason for hiding this comment

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

One reason I put this forth is that the TraversableOnce problem is harder; its replacement IterableOnce doesn't exist in Scala 2.12. The same overload strategy doesn't work out quite right for the places it's used (generic types and function signatures make the overload ambiguous). I am considering proposing just changing the type there for 3.0.

Copy link
Member

Choose a reason for hiding this comment

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

I can see setAll() is being used though. but maybe it won't work even after a rebuild (bin compat)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Calls to setAll will now bind to the more specific Iterable arg version in all cases in Spark, and I'm not aware of any Scala classes that aren't Iterable to begin with. One consequence I suppose is that passing an Iterator will use the deprecated method. But it'll still be there. I don't anticipate we'll remove it until we want to support Scala 2.13 and that won't be in 3.0. For now, no method is removed so should be no problem.

Copy link
Contributor

@gaborgsomogyi gaborgsomogyi left a comment

Choose a reason for hiding this comment

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

LGTM.

@srowen
Copy link
Member Author

srowen commented May 14, 2019

Merged to master

@srowen srowen closed this in a10608c May 14, 2019
@srowen srowen deleted the SPARK-27680 branch May 15, 2019 01:44
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.

6 participants