spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marmbrus <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4358][SQL] Let BigDecimal do checking t...
Date Tue, 18 Nov 2014 00:18:26 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message