This is an automated email from the ASF dual-hosted git repository.
zml1206 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 065d2e30de [MINOR][CORE] Avoid O(n^2) stack walk in
CallerInfo.inBloomFilterStatFunctionCall (#12477)
065d2e30de is described below
commit 065d2e30de86a174a11ee26cf2c5b0df04ff1523
Author: YangJie <[email protected]>
AuthorDate: Thu Jul 9 13:32:03 2026 +0800
[MINOR][CORE] Avoid O(n^2) stack walk in
CallerInfo.inBloomFilterStatFunctionCall (#12477)
---
.../org/apache/gluten/extension/caller/CallerInfo.scala | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git
a/gluten-core/src/main/scala/org/apache/gluten/extension/caller/CallerInfo.scala
b/gluten-core/src/main/scala/org/apache/gluten/extension/caller/CallerInfo.scala
index 7dfaaaa774..a65c79da7a 100644
---
a/gluten-core/src/main/scala/org/apache/gluten/extension/caller/CallerInfo.scala
+++
b/gluten-core/src/main/scala/org/apache/gluten/extension/caller/CallerInfo.scala
@@ -79,10 +79,14 @@ object CallerInfo {
}
private def inBloomFilterStatFunctionCall(stack: Seq[StackTraceElement]):
Boolean = {
- val res = stack.exists(
- _.getClassName.equals("org.apache.spark.sql.DataFrameStatFunctions")
- && stack.exists(_.getMethodName.equals("bloomFilter")))
- res
+ // Two independent existence checks over the stack. The previous shape
used a nested
+ // `stack.exists(_.getMethodName.equals(...))` inside the outer predicate,
which re-walked
+ // the whole stack for every candidate frame - O(n^2) in stack depth.
Splitting the checks
+ // makes each a single pass. `&&` short-circuits, so the bloomFilter scan
only runs when a
+ // DataFrameStatFunctions frame is present.
+ val hasStatFunctionsClass =
+
stack.exists(_.getClassName.equals("org.apache.spark.sql.DataFrameStatFunctions"))
+ hasStatFunctionsClass &&
stack.exists(_.getMethodName.equals("bloomFilter"))
}
/** For testing only. */
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]