Github user jaceklaskowski commented on a diff in the pull request: https://github.com/apache/spark/pull/706#discussion_r12508408 --- Diff: project/SparkBuild.scala --- @@ -297,7 +273,7 @@ object SparkBuild extends Build { val chillVersion = "0.3.6" val codahaleMetricsVersion = "3.0.0" val jblasVersion = "1.2.3" - val jets3tVersion = if ("^2\\.[3-9]+".r.findFirstIn(hadoopVersion).isDefined) "0.9.0" else "0.7.1" + val jets3tVersion = "^2\\.[3-9]+".r.findFirstIn(hadoopVersion).fold("0.7.1")(_ => "0.9.0") --- End diff -- I myself learnt it not so long ago and noticed it spurred some discussions about it in the Scala community (with [Martin Ordersky himself](http://stackoverflow.com/a/5332657/1305344)). [Functional Programming in Scala](http://www.manning.com/bjarnason/) reads on page 69 (in the pdf version): *"Itâs fine to use pattern matching, though you should be able to implement all the functions besides map and getOrElse without resorting to pattern matching."* So I followed the advice and applied Option.map(...).getOrElse(...) quite intensively, but...IntelliJ IDEA just before I committed the change suggested to replace it with fold. I thought I'd need to change my habits once more and sent the PR. With all that said, it's not clear what's the most idiomatic approach, but [pattern matching is in my opinion a step back from map/getOrElse](https://github.com/scala/scala/blob/2.12.x/src/library/scala/Option.scala#L156) and there's no need for it. I'd appreciate being corrected and could even replace `Option.fold` with `map`/`getOrElse` if that would make the PR better for more committers.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---