Alfred-Mountfield commented on pull request #12451:
URL: https://github.com/apache/arrow/pull/12451#issuecomment-1046294849


   That'd be great, thank you :)
   
   I believe the code snippet in [that last 
Jira](https://issues.apache.org/jira/browse/ARROW-15651) I sent should probably 
be about right.
   
   I believe the problem is that when a struct vector is made (either through 
the `Builder` or through the `makeVector` methods), the underlying metadata is 
incorrect when you have a null struct within that vector. In the simplest case, 
a vector of a single null struct, with one field, e.g.
   ```javascript
   let vec = makeVector({
       data: [null],
       type: struct_field.type,
       nullable: true,
   });
   ```
   
   or 
   ```javascript
   let builder = new Builder({
       type: struct_field.type,
       nullValues: [null, undefined],
   });
   builder.append(null);
   let vec = builder.toVector();
   ```
   
   Then the `children`, `nullCount`, and `length`s are not what I'd expect them 
to be. I _believe_ (although I'm still not 100% sure I'm reading the spec 
correctly), that all three of those should be equal to 1.
   
   Where the underlying memory layout will have a null-bitmap buffer of 
`00000001`, and one child array (which in also has a null value, [as shown in 
the 
specification](https://arrow.apache.org/docs/format/Columnar.html#struct-layout))
   
   As the code-snippet (and 
[StackBlitz](https://stackblitz.com/edit/node-kpgovc?file=index.js)) shows, all 
three of those methods seem to have differing values and I'm not really sure 
why. 
   
   It's possible that those three values are not adequate for testing that it 
is correct though, we might need to check that the underlying buffers are 
initialised for more complex field types on the struct, etc.


-- 
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