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

    https://github.com/apache/spark/pull/4519#discussion_r24470931
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Column.scala ---
    @@ -66,22 +66,36 @@ trait Column extends DataFrame {
        */
       def isComputable: Boolean
     
    +  /** Removes the top project so we can get to the underlying plan. */
    +  private def stripProject(p: LogicalPlan): LogicalPlan = p match {
    +    case Project(_, child) => child
    +    case p => sys.error("Unexpected logical plan (expected Project): " + p)
    +  }
    +
       private def computableCol(baseCol: ComputableColumn, expr: Expression) = 
{
         val plan = Project(Seq(expr match {
           case named: NamedExpression => named
           case unnamed: Expression => Alias(unnamed, "col")()
    -    }), baseCol.plan)
    +    }), stripProject(baseCol.plan))
    --- End diff --
    
    Nit: I would consider splitting this up since matching in the constructor 
is not super easy to read.


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