jbonofre opened a new issue, #1471:
URL: https://github.com/apache/arrow-java/issues/1471

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `DenseUnionVector.getField()` lists the children in the order their type ids 
were registered, but the vector of a child is created when it is first used, 
which can be in another order. For example, registering an int type id and then 
a double type id, and writing a double first, creates the double vector first. 
Code that pairs the children of the field with the child vectors by position 
then mixes them up:
   
   - `getChildrenFromFields()` returns the vectors in the order they were 
created. `VectorUnloader` and `Data.exportVector` take the schema from 
`getField()` and the buffers from `getChildrenFromFields()`, so the buffers of 
the double child are written under the int field. An IPC round trip of `[1.5, 
42]` reads back `[2.08E-322, 0]`.
   - The transfer pair pairs each type id with the vector at the same position 
in the internal struct. `transfer()` returns `[42, 1.5]` for `[1.5, 42]`, and 
`splitAndTransfer()` splits each child at the offsets of the other, which fails 
with `Invalid parameters startIndex: 1, length: 1 for valueCount: 1` or returns 
wrong values.
   
   A related problem: a target created by `getTransferPair()` has no declared 
type ids, so `registerNewTypeId()` assigns the next type id by count. When the 
type ids of the source are not `0..n-1`, that type id can already be in use: 
with type ids `[2, 0]`, it returns 2 and overwrites the first child.
   
   These happen on `main` before #1419 too. Follow-up to #1419.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to