GitHub user kiszk opened a pull request:
https://github.com/apache/spark/pull/13680
[SPARK-15962][SQL] Introduce additonal implementation with a dense format
for UnsafeArrayData
## What changes were proposed in this pull request?
This PR introduces two implementations for ```UnsafeArrayData```. One is an
sparse array ```UnsafeArrayDataSparse``` that is the original format of
```UnsafeArrayData```. The other is a dense array ```UnsafeArrayDataDense```
that is a new format of ```UnsafeArrayData```.
```UnsafeArrayDataSparse``` accepts ```null``` value in each entry of an
array. However, it increases memory footprint (e.g. 2x for an integer array)
due to existence of [```offsets```
area](https://github.com/apache/spark/blob/43b149fb885a27f9467aab28e5195f6f03aadcf0/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java#L35).
In some cases (e.g. an unsafe array is created from an primitive array by a
method ```fromPrimitiveArray```, we know there is no ```null``` value in an
array. ```UnsafeArrayDataDense``` can reduce memory footprint since it does not
have ```offsets``` area.
## How was this patch tested?
Tested by existing unit tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kiszk/spark SPARK-15962
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13680.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 #13680
----
commit 2b15523ddf0c8b8387302611d564fcc2de239af5
Author: Kazuaki Ishizaki <[email protected]>
Date: 2016-06-14T19:46:29Z
add two implementations (sparse and dense) for UnsafeArrayData
commit 639b32d91cee1572e1146f325c40e158a8158ce5
Author: Kazuaki Ishizaki <[email protected]>
Date: 2016-06-15T06:19:18Z
fix failures of testsuite
----
---
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]