Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13192#discussion_r64333811
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeFormatter.scala
 ---
    @@ -49,6 +49,24 @@ object CodeFormatter {
         }
         code.result()
       }
    +
    +  def stripOverlappingComments(codeAndComment: CodeAndComment): 
CodeAndComment = {
    +    val code = new StringBuilder
    +    val map = codeAndComment.comment
    +    var lastLine: String = "dummy"
    +    codeAndComment.body.split('\n').foreach { l =>
    +      val line = l.trim()
    +      val skip = lastLine.startsWith("/*") && lastLine.endsWith("*/") &&
    +        line.startsWith("/*") && line.endsWith("*/") &&
    +        map(lastLine).substring(3).contains(map(line).substring(3))
    --- End diff --
    
    I think it's okay for the performance.
    - This function is used for at every `CodeAndComment` creation once.
    - It scans `codeAndComment.body` once.
    - Map lookup occurs on each line at most once. Also, it does not cost much 
in this case.


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