apache / apache/arrow-java

[Java] Inconsistent logic for type IDs in Union vectors

Open
#255 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

The current logic for calculating the type IDs in UnionVector#getField and DenseUnionVector#getField is:
1. DenseUnionVector uses an increasing counter 
1. UnionVector uses the ordinal of the type enum
1. Both completely ignore the type IDs provided at construction as part of fieldType (if provided)

We encountered this inconsistency while testing a direct roundtrip of a union vector between pyarrow and Java with the C Data Interface ('direct' here means without using VectorSchemaRoot/RecordBatch). The identifiers for the type IDs differ after completing a roundtrip. 

 

**Reporter**: [Roee Shlomo](https://issues.apache.org/jira/browse/ARROW-14271) / @roee88

**Note**: *This issue was originally created as [ARROW-14271](https://issues.apache.org/jira/browse/ARROW-14271). 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 UnionVector#getField and DenseUnionVector#getField, then trace how fieldType and its provided type IDs are handled during construction. Reproduce the direct pyarrow-to-Java C Data Interface roundtrip and verify that both vector types preserve consistent type IDs after the roundtrip.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.