Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/11301#discussion_r62436283
--- 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 --
The current version does not use ```CurrentOrigin.set``` to update
```TreeNode.origin```. ```CurrentOrigin.set``` at
https://github.com/apache/spark/pull/11301/files#diff-ac415c903887e49486ba542a65eec980R49
update ```TreeNode.origin``` for ```logicalPlan```.
For the first problem, I am afraid that two queries ```filter``` and
```orderBy``` share one unique ```Expression``` for ```$"value"```. If one
```Expression``` is shared, we have to keep ```origin``` for a expression tree
for each query and set it into ```Expression``` in the tree at code generation.
For the second problem, I expected the same behavior. I will investigate it.
---
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]