GitHub user kiszk opened a pull request:
https://github.com/apache/spark/pull/13758
[SPARK-16043][SQL] Prepare GenericArrayData implementation specialized for
a primitive array
## What changes were proposed in this pull request?
This PR addresses a ToDo of ```GenericArrayData``` class. Current
implementation of ```GenericArrayData``` leads to boxing/unboxing if type of
array elements are primitive. It would be good to eliminate boxing/unboxing
from the view of runtime memory footprint and performance.
This PR eliminattes boxing/unboxing by preparing sub classes of
```GenericArrayData``` to specialize operations in these classes. This PR
prepare a new method ```GenericArrayData.allocate(...) ``` that can return
generic ```GenericArrayData``` instance or a ```Generic<Type>ArrayData```
instance specialized for ```<Type>``` type array.
Here are major improvements:
1. Hold an array in a primitive array (previously ```Object[]``` is used
and boxing happened in a constructor)
2. a method "get```<Type>```()" gets a value from an primitive array
(previously unboxing happened)
3. a method "to```<Type>```Array" performs data copy using
```System.arraycopy``` (previously unboxing happened)
## How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration
tests, manual tests)
add unit tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kiszk/spark SPARK-16043
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13758.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #13758
----
commit 17bdfcf7b9c155fe05eb75f73d661c2863cdf2d9
Author: Kazuaki Ishizaki <[email protected]>
Date: 2016-06-18T06:47:11Z
Implementation of GenericArrayData specialized for primitive type array
add unit tests
----
---
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]