apache / apache/arrow-java

[Java] UnionListWriter does not behave properly when multiple lists are written in the same list

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
Type: bug
Dominant language
Java
Stars
94
Forks
152
Avg merge
3d 16h
Merged PRs (30d)
11

Description

if you run the following code:
```Java
ListVector listVector = new ListVector("list", allocator, null);
listVector.allocateNew();
UnionListWriter listWriter = new UnionListWriter(listVector);

listWriter.start();
listWriter.startList();

listWriter.list("a").startList();
listWriter.list("a").bigInt().writeBigInt(1);
listWriter.list("a").bigInt().writeBigInt(2);
listWriter.list("a").bigInt().writeBigInt(3);
listWriter.list("a").endList();

listWriter.list("a").startList();
listWriter.list("a").bigInt().writeBigInt(4);
listWriter.list("a").bigInt().writeBigInt(5);
listWriter.list("a").endList();

listWriter.endList();
listWriter.end();

listWriter.setValueCount(1);
```

listVector will contain:
```
[{"a":[1,2,3,4,5]}]
```
Instead of
```
[{"a":[1,2,3],[4,5]}]
```

**Reporter**: [Abdel Hakim Deneche](https://issues.apache.org/jira/browse/ARROW-307) / @adeneche

**Note**: *This issue was originally created as [ARROW-307](https://issues.apache.org/jira/browse/ARROW-307). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start with UnionListWriter and the ListVector setup shown in the reproducer, then run the example to observe how repeated list("a") sections are stored. Trace the writer behavior for nested lists and add a regression test based on the example. Done means the value is represented as [{"a":[1,2,3],[4,5]}] rather than a single flattened list.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.