Josh Rosen created SPARK-19555:
----------------------------------

             Summary: Improve inefficient StringUtils.escapeLikeRegex() method
                 Key: SPARK-19555
                 URL: https://issues.apache.org/jira/browse/SPARK-19555
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 2.0.0
            Reporter: Josh Rosen


Spark's StringUtils.escapeLikeRegex() method is written inefficiently, 
performing tons of object allocations due to the use zip(), flatMap() , and 
mkString. Instead, I think method should be rewritten in an imperative style 
using a Java string builder.

This method can become a performance bottleneck in cases where regex 
expressions are used with non-constant-foldable expressions (e.g. the regex 
expression comes from the data rather than being part of the query).

Here's the code in question: 
https://github.com/apache/spark/blob/d785217b791882e075ad537852d49d78fc1ca31b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala#L28



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to