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

    https://github.com/apache/spark/pull/3208#discussion_r20477073
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/HiveTypeCoercion.scala
 ---
    @@ -460,6 +460,20 @@ trait HiveTypeCoercion {
           // Skip nodes who's children have not been resolved yet.
           case e if !e.childrenResolved => e
     
    +      case g @ GetItem(c, o @ IntegralType()) if o.dataType != IntegerType 
=>
    +   GetItem(c, Cast(o, IntegerType)) 
    +
    +      case s @ Substring(r, p @ IntegralType(), l @ IntegralType()) =>
    +   var new_p = p
    +   var new_l = l
    +   if (p.dataType != IntegerType) {
    +     new_p = Cast(p, IntegerType)
    +        }
    +   if (l.dataType != IntegerType) {
    +     new_l = Cast(l, IntegerType)
    +   }
    +   Substring(r, new_p, new_l)
    --- End diff --
    
    It might be clearer / shorter to do this as two separate rules.  I 
personally try to avoid `var` whenever possible.


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