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

    https://github.com/apache/spark/pull/10247#discussion_r47579246
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala ---
    @@ -316,6 +317,21 @@ trait Row extends Serializable {
       }
     
       /**
    +   * Returns the Optional value at position i.
    +   * If the value is null or if it cannot be cast to the requested type, 
None is returned.
    +   */
    +  def getAsOpt[T](i: Int): Option[T] = {
    +    val value = {
    +      if (i < length) {
    +        if (isNullAt(i)) None
    +        else catching(classOf[ClassCastException]) opt getAs[T](i)
    --- End diff --
    
    We typically avoid infix notation and this style of `if`.
    
    https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide
    
    Also, why do we want to hide `ClassCastException` from the user, this seems 
more confusing than helpful.


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