GitHub user cloud-fan opened a pull request:
https://github.com/apache/spark/pull/18483
[SPARK-17528][SQL] data should be copied properly before saving into
InternalRow
## What changes were proposed in this pull request?
For performance reasons, `UnsafeRow.getString`, `getStruct`, etc. return a
"pointer" that points to a memory region of this unsafe row. This makes the
unsafe projection a little dangerous, because all of its output rows share one
instance.
When we implement SQL operators, we should be careful to not cache the
input rows because they may be produced by unsafe projection from child
operator and thus its content may change overtime.
However, when we updating values of InternalRow(e.g. in mutable projection
and safe projection), we only copy UTF8String, we should also copy InternalRow,
ArrayData and MapData. This PR fixes this, and also fixes the copy of vairous
InternalRow, ArrayData and MapData implementations.
## How was this patch tested?
new regression tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloud-fan/spark fix-copy
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18483.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 #18483
----
commit f630cbd04b9fc415314a22241a4945f514097efe
Author: Wenchen Fan <[email protected]>
Date: 2017-06-29T16:56:18Z
data should be copied properly before saving into InternalRow
----
---
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]