Skip to content

ARROW-10690: [Java] Fix ComplexCopier bug for list vector#8742

Closed
projjal wants to merge 2 commits intoapache:masterfrom
projjal:listcomplexcopier
Closed

ARROW-10690: [Java] Fix ComplexCopier bug for list vector#8742
projjal wants to merge 2 commits intoapache:masterfrom
projjal:listcomplexcopier

Conversation

@projjal
Copy link
Copy Markdown
Contributor

@projjal projjal commented Nov 23, 2020

When copying a list vector using ComplexCopier, if the target list vector is non-empty, the result vector is incorrect. For example, if src = [[1,2], [3, 4]], tgt = [[5, 6], [7, 8]], copying src to tgt gives tgt = [[5, 6, 1, 2], [3, 4]] instead of [[1,2], [3, 4]]
Similary when using copyFrom(/Safe) method if the vector at the index is non-empty, the listElement is appended instead. For above src and tgt vector, tgt.copyFrom(0, 0, src) gives [[5, 6, 1, 2], []] instead of [[1,2], [7, 8]]

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@tvamsikalyan tvamsikalyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

If caller is expecting to reuse ListVector and start the list at an index less than what was previously written, then we are adjusting the state of lastSet index.

@liyafan82
Copy link
Copy Markdown
Contributor

For the second example in the discussion, the result should be [[1, 2], [7, 8]]?

@projjal
Copy link
Copy Markdown
Contributor Author

projjal commented Nov 24, 2020

For the second example in the discussion, the result should be [[1, 2], [7, 8]]?

You are right. I miswrote that part. Updated the description.

pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
When copying a list vector using ComplexCopier, if the target list vector is non-empty, the result vector is incorrect. For example, if src = [[1,2], [3, 4]], tgt = [[5, 6], [7, 8]], copying src to tgt gives tgt = [[5, 6, 1, 2], [3, 4]] instead of [[1,2], [3, 4]]
Similary when using copyFrom(/Safe) method if the vector at the index is non-empty, the listElement is appended instead. For above src and tgt vector, tgt.copyFrom(0, 0, src) gives [[5, 6, 1, 2], []] instead of [[1,2], [7, 8]]

Closes apache#8742 from projjal/listcomplexcopier and squashes the following commits:

1531319 <Projjal Chanda> move condition from list writer writer to list vector
71112eb <Projjal Chanda> fix complex copier

Authored-by: Projjal Chanda <iam@pchanda.com>
Signed-off-by: Praveen <praveen@dremio.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants