spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Erlandson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-27296) User Defined Aggregating Functions (UDAFs) have a major efficiency problem
Date Sat, 06 Jul 2019 20:31:00 GMT

    [ https://issues.apache.org/jira/browse/SPARK-27296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16879747#comment-16879747
] 

Erik Erlandson commented on SPARK-27296:
----------------------------------------

I wrote up my benchmarking results [here|https://github.com/apache/spark/pull/25024#issue-293548866].
For aggregators having a non-trivial serde cost, the performance improvement can be two orders
of magnitude. For aggregators with more simple serde, the improvement is correspondingly smaller.

> User Defined Aggregating Functions (UDAFs) have a major efficiency problem
> --------------------------------------------------------------------------
>
>                 Key: SPARK-27296
>                 URL: https://issues.apache.org/jira/browse/SPARK-27296
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core, SQL, Structured Streaming
>    Affects Versions: 2.3.3, 2.4.0, 3.0.0
>            Reporter: Erik Erlandson
>            Assignee: Erik Erlandson
>            Priority: Major
>              Labels: performance, usability
>
> Spark's UDAFs appear to be serializing and de-serializing to/from the MutableAggregationBuffer
for each row.  This gist shows a small reproducing UDAF and a spark shell session:
> [https://gist.github.com/erikerlandson/3c4d8c6345d1521d89e0d894a423046f]
> The UDAF and its compantion UDT are designed to count the number of times that ser/de
is invoked for the aggregator.  The spark shell session demonstrates that it is executing
ser/de on every row of the data frame.
> Note, Spark's pre-defined aggregators do not have this problem, as they are based on
an internal aggregating trait that does the correct thing and only calls ser/de at points
such as partition boundaries, presenting final results, etc.
> This is a major problem for UDAFs, as it means that every UDAF is doing a massive amount
of unnecessary work per row, including but not limited to Row object allocations. For a more
realistic UDAF having its own non trivial internal structure it is obviously that much worse.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message