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

    https://github.com/apache/spark/pull/7910#discussion_r36438453
  
    --- Diff: 
core/src/main/scala/org/apache/spark/ui/exec/ExecutorThreadDumpPage.scala ---
    @@ -48,7 +48,17 @@ private[ui] class ExecutorThreadDumpPage(parent: 
ExecutorsTab) extends WebUIPage
         val time = System.currentTimeMillis()
         val maybeThreadDump = sc.get.getExecutorThreadDump(executorId)
     
    -    val content = maybeThreadDump.map { threadDump =>
    +    val grepExp = Option(request.getParameter("grepexp"))
    +
    +    val filteredContent = maybeThreadDump.map { threadDump =>
    +      threadDump.filter(thread =>
    +        if (!grepExp.isDefined) {
    +          true
    +        } else {
    +          thread.stackTrace.filter(_ >= ' ').matches(grepExp.get)
    --- End diff --
    
    The filter seems strange to me.  Won't stripping out newlines etc. lead to 
some weird matches?
    
    Also, I think `String.matches` may not be what we want -- that matches 
against the entire string, not against any contained substring.  It would most 
likely mean that everyone would have to make their pattern `".*<pattern>.*"`.  
I think we'd rather use `pattern.find()`, since that is more like "grep".  
Should probably also be in multiline mode, so:
    
    ```scala
    val grepExp = Option(request.getParamter("grepexp")).map(Pattern.compile(_, 
Pattern.MULTILINE))
    ...
    grepExp.map { grep => 
grep.matcher(thread.stackTrace).find()}.getOrElse(true)
    ```


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