Github user markhamstra commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14332#discussion_r71993163
  
    --- Diff: 
examples/src/main/scala/org/apache/spark/examples/ml/DataFrameExample.scala ---
    @@ -54,14 +54,13 @@ object DataFrameExample {
           }
         }
     
    -    parser.parse(args, defaultParams).map { params =>
    -      run(params)
    -    }.getOrElse {
    -      sys.exit(1)
    +    parser.parse(args, defaultParams) match {
    +      case Some(params) => run(params)
    +      case _ => sys.exit(1)
         }
    --- End diff --
    
    I wouldn't change these kinds of constructs.  It's almost purely a 
stylistic issue (for which I don't believe we have an officially declared 
preference), and 1) pattern matching over Options is poor form, IMO; 2) the 
pattern matching alternative here doesn't any more unambiguously imply or 
signal use of side effects.
    
    If I had my way, we'd `fold` Options, but that's an argument I lost long 
ago:
    ```scala
    val anOption: Option[T] = ...
    anOption.fold { handleNone } { t => ... }
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to