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

    https://github.com/apache/spark/pull/11301#discussion_r62431753
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Column.scala ---
    @@ -37,6 +39,16 @@ private[sql] object Column {
       def apply(expr: Expression): Column = new Column(expr)
     
       def unapply(col: Column): Option[Expression] = Some(col.expr)
    +
    +  @scala.annotation.varargs
    +  def updateExpressionsOrigin(cols: Column*): Unit = {
    +    // Update Expression.origin using the callSite of an operation
    +    val callSite = org.apache.spark.util.Utils.getCallSite().shortForm
    +    cols.map(col => col.expr.foreach(e => e.origin.callSite = 
Some(callSite)))
    +    // Update CurrentOrigin for setting origin for LogicalPlan node
    +    CurrentOrigin.set(
    +      Origin(Some(callSite), CurrentOrigin.get.line, 
CurrentOrigin.get.startPosition))
    --- End diff --
    
    Maybe, we can use `withOrigin` to set CurrentOrigin temporarily.
    Also, we may need to create CurrentOrigin for each expression because in 
`TreeNode`, `origin` is set by `CurrentOrigin.get`.
    Otherwise, some non-related expressions share a same origin.


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