Skip to content

[SPARK-13390][SQL][branch-1.6]Fix the issue that Iterator.map().toSeq is not Serializable - #11334

Closed
zsxwing wants to merge 1 commit into
apache:branch-1.6from
zsxwing:SPARK-13390
Closed

[SPARK-13390][SQL][branch-1.6]Fix the issue that Iterator.map().toSeq is not Serializable#11334
zsxwing wants to merge 1 commit into
apache:branch-1.6from
zsxwing:SPARK-13390

Conversation

@zsxwing

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

scala.collection.Iterator's methods (e.g., map, filter) will return an AbstractIterator which is not Serializable. E.g.,

scala>valiter=Array(1, 2, 3).iterator.map(_ +1)
iter:Iterator[Int] = non-empty iterator
scala> println(iter.isInstanceOf[Serializable])
false

If we call something like Iterator.map(...).toSeq, it will create a Stream that contains a non-serializable AbstractIterator field and make the Stream be non-serializable.

This PR uses toArray instead of toSeq to fix such issue in def createDataFrame(data: java.util.List[_], beanClass: Class[_]): DataFrame.

How was the this patch tested?

Jenkins tests.

@zsxwing

Copy link
Copy Markdown
MemberAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

Test build #51816 has finished for PR 11334 at commit 40e6b2f.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zsxwing

Copy link
Copy Markdown
MemberAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

Test build #51824 has finished for PR 11334 at commit 40e6b2f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen

Copy link
Copy Markdown
Member

LGTM

asfgit pushed a commit that referenced this pull request Feb 24, 2016
…q is not Serializable
## What changes were proposed in this pull request?
`scala.collection.Iterator`'s methods (e.g., map, filter) will return an `AbstractIterator` which is not Serializable. E.g.,
```Scala
scala> val iter = Array(1, 2, 3).iterator.map(_ + 1)
iter: Iterator[Int] = non-empty iterator
scala> println(iter.isInstanceOf[Serializable])
false
```
If we call something like `Iterator.map(...).toSeq`, it will create a `Stream` that contains a non-serializable `AbstractIterator` field and make the `Stream` be non-serializable.
This PR uses `toArray` instead of `toSeq` to fix such issue in `def createDataFrame(data: java.util.List[_], beanClass: Class[_]): DataFrame`.
## How was the this patch tested?
Jenkins tests.
Author: Shixiong Zhu <shixiong@databricks.com>
Closes#11334 from zsxwing/SPARK-13390.
@srowen

Copy link
Copy Markdown
Member

Merged to 1.6

@zsxwingzsxwing closed this Feb 24, 2016
@zsxwing
zsxwing deleted the SPARK-13390 branch February 24, 2016 18:47
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zsxwing@SparkQA@srowen