You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Josh Rosen (JIRA)" <ji...@apache.org> on 2016/06/03 00:03:59 UTC

[jira] [Created] (SPARK-15742) Reduce collections allocations in Catalyst tree transformation methods

Josh Rosen created SPARK-15742:
----------------------------------

             Summary: Reduce collections allocations in Catalyst tree transformation methods
                 Key: SPARK-15742
                 URL: https://issues.apache.org/jira/browse/SPARK-15742
             Project: Spark
          Issue Type: Improvement
          Components: SQL
            Reporter: Josh Rosen
            Assignee: Josh Rosen


In Catalyst's TreeNode {{transform}} methods we end up calling {{productIterator.map(...).toArray()}} in a number of places, which is slightly inefficient because it needs to allocate and grow ArrayBuilders. Since we already know the size of the final output ({{productArity}}), we can simply allocate an array up-front and use a while loop to consume the iterator and populate the array.

For most workloads, this performance difference is negligible but it does make a measurable difference in optimizer performance for queries that operate over very wide schemas (thousands of columns).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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