GitHub user michalsenkyr opened a pull request:
https://github.com/apache/spark/pull/18009
[SPARK-18891][SQL] Support for specific Java List subtypes
## What changes were proposed in this pull request?
Add support for specific Java `List` subtypes in deserialization as well as
a generic implicit encoder.
All `List` subtypes are supported by using either the size-specifying
constructor (one `int` parameter) or the default constructor.
Interfaces/abstract classes use the following implementations:
* `java.util.List`, `java.util.AbstractList` or
`java.util.AbstractSequentialList` => `java.util.ArrayList`
## How was this patch tested?
```bash
build/mvn -DskipTests clean package && dev/run-tests
```
Additionally in Spark shell:
```
scala> val jlist = new java.util.LinkedList[Int]; jlist.add(1)
jlist: java.util.LinkedList[Int] = [1]
res0: Boolean = true
scala> Seq(jlist).toDS().map(_.element()).collect()
res1: Array[Int] = Array(1)
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/michalsenkyr/spark dataset-java-lists
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18009.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 #18009
----
commit 1cd6b6b4cdb0ff8a5cc42a105c7a8d4bc16fc0c1
Author: Michal Senkyr <[email protected]>
Date: 2017-04-16T15:54:40Z
Add arbitrary Java List serialization/deserialization support
----
---
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]