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

    https://github.com/apache/spark/pull/14332#discussion_r72014373
  
    --- 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 --
    
    It appears that you are reading what you want to see instead of what is 
really there.  All of the examples in the Scala API doc involve side-effects.  
The three examples are essentially equivalent in their intent and effects, and 
using pattern matching with `Option` is clearly called out as the least 
idiomatic.
    
    `fold` isn't in question since it has already been ruled out by other Spark 
committers as beyond the ken of those unfamiliar with idiomatic functional 
programming.  I see no reason, however, to do anything different in Spark's 
code than what the Scala API declares to be "most idiomatic way".


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to