MaxGekk commented on code in PR #43671:
URL: https://github.com/apache/spark/pull/43671#discussion_r1383403781


##########
sql/core/src/main/scala/org/apache/spark/sql/package.scala:
##########
@@ -98,7 +98,10 @@ package object sql {
       f
     } else {
       val st = Thread.currentThread().getStackTrace
-      var i = 3
+      var i = 0

Review Comment:
   Isn't it safe to don't assume any such things? BTW, this PR avoids any 
assumptions in `DataFrameQueryContext.apply` too. 
   
   > We can be sure that the first stacktrace element belongs to getStackTrace()
   
   IMHO, it is risky to assume this. Is it document in `getStackTrace()`? I 
haven't found so. Look at its docs:
   ```
   Some virtual machines may, under some circumstances, omit one or more stack 
frames from the stack
   trace.  In the extreme case, a virtual machine that has no stack trace 
information concerning this thread is
   permitted to return a zero-length array from this method.
   ```
   
   How can we guarantee anythings in such circumstances?



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