[
https://issues.apache.org/jira/browse/SPARK-30413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dongjoon Hyun resolved SPARK-30413.
-----------------------------------
Fix Version/s: 3.0.0
Resolution: Fixed
Issue resolved by pull request 27088
[https://github.com/apache/spark/pull/27088]
> Avoid unnecessary WrappedArray roundtrip in GenericArrayData constructor
> ------------------------------------------------------------------------
>
> Key: SPARK-30413
> URL: https://issues.apache.org/jira/browse/SPARK-30413
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Josh Rosen
> Assignee: Josh Rosen
> Priority: Major
> Fix For: 3.0.0
>
>
> GenericArrayData has a constructor which accepts a {{seqOrArray: Any}}
> parameter. This constructor was originally added for use in situations where
> we don't know the actual type at compile-time (e.g. when converting UDF
> outputs). It's also called (perhaps unintentionally) in code paths where we
> could plausibly and statically know that the type is {{Array[Any]}} (in which
> case we could simply call the primary constructor).
> In the current version of this code there's an unnecessary performance
> penalty for going through this path when {{seqOrArray}} is an {{Array[Any]}}:
> we end up converting the array into a WrappedArray, then call a method to
> unwrap it back into an array: this results in a bunch of unnecessary method
> calls. See https://scastie.scala-lang.org/7jOHydbNTaGSU677FWA8nA for an
> example of situations where this can crop up.
> Via a small modification to this constructor's implementation, I think we can
> effectively remove this penalty.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]