You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yhuai <gi...@git.apache.org> on 2016/01/17 18:35:02 UTC

[GitHub] spark pull request: [SPARK-12841][SQL] fix cast in filter

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

    https://github.com/apache/spark/pull/10781#discussion_r49949314
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Column.scala ---
    @@ -133,6 +133,15 @@ class Column(protected[sql] val expr: Expression) extends Logging {
     
         case func: UnresolvedFunction => UnresolvedAlias(func, Some(func.prettyString))
     
    +    // If we have a top level Cast, there is a chance to give it a better alias, if there is a
    +    // NamedExpression under this Cast.
    +    case c: Cast => c.transformUp {
    +      case Cast(ne: NamedExpression, to) => UnresolvedAlias(Cast(ne, to))
    +    } match {
    +      case ne: NamedExpression => ne
    +      case other => Alias(expr, expr.prettyString)()
    +    }
    --- End diff --
    
    We use `transformUp` at here to make this logic equivalent with the original logic that we have in the `cast`, right (since we want to fix it in 1.6)? (in future, will it be possible to just use `cast Cast(ne: NamedExpression, to) => UnresolvedAlias(Cast(ne, to))`?)


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