hvanhovell commented on code in PR #47839:
URL: https://github.com/apache/spark/pull/47839#discussion_r1726152974


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/trees/origin.scala:
##########
@@ -84,6 +87,49 @@ object CurrentOrigin {
     val ret = try f finally { set(previous) }
     ret
   }
+
+  /**
+   * This helper function captures the Spark API and its call site in the user 
code from the current
+   * stacktrace.
+   *
+   * As adding `withOrigin` explicitly to all Spark API definition would be a 
huge change,
+   * `withOrigin` is used only at certain places where all API implementation 
surely pass through
+   * and the current stacktrace is filtered to the point where first Spark API 
code is invoked from
+   * the user code.
+   *
+   * As there might be multiple nested `withOrigin` calls (e.g. any Spark API 
implementations can
+   * invoke other APIs) only the first `withOrigin` is captured because that 
is closer to the user
+   * code.
+   *
+   * @param f The function that can use the origin.
+   * @return The result of `f`.
+   */
+  private[sql] def withOrigin[T](f: => T): T = {

Review Comment:
   Moved here so we could use it in sql/api.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to