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

    https://github.com/apache/spark/pull/4688#discussion_r25485041
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
    @@ -540,6 +561,29 @@ private[spark] class Client(
         amContainer
       }
     
    +  def setupCredentials(): Unit = {
    +    Option(args.principal) match {
    --- End diff --
    
    I agree.  Odersky himself as argued against using `Option(maybeNull)` if 
you are just going to immediately pattern match on it.  `if / else` would 
probably be simpler here.
    
    I'm not recommending it in this case, but just fyi you can also match on 
multiple things at once:
    
    ```
    (Option(args.principal), Option(args.keytab)) match {
      case (Some(principal), Some(keytabPath)) => ...
      case (Some(principal), None) => throw new SparkException( ...)
      case _ => credentials = UserGroupInformation.getCurrentUser.getCredentials
    }
    ```


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