Proper way to initialize an ListArray.Builder
#321
Unanswered
mobiusklein
asked this question in
Q&A
Replies: 1 comment
-
|
I'm not sure anyone actively involved in the project today could tell you why the code is the way it is; it seems to date back a little over six years. A better question would be whether there are any improvements that could be made that would be compatible with existing code, and I think that's a pretty hard constraint to meet. Perhaps I often think it would be nice to redesign the builder APIs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been using this library for a while now, but I have found a few places where I miss an invariant over how to initialize a
ListArray.Builder.arrow-dotnet/src/Apache.Arrow/Arrays/ListArray.cs
Lines 46 to 52 in 3e235ea
When initializing the builder the
ValueOffsetsBufferBuilderis empty. When I am attentive, I remember to immediately call theAppendmethod which adds0to theValueBuilder.Lengthattribute being0. This ensures that the offset to the start of the first list in the array is 0, as shown in the specification https://arrow.apache.org/docs/format/Intro.html#list. Otherwise trying to read this array later will skip over everything before the first call toAppend.I recently spent a time running down a bug that was effectively that I forgot to call
AppendafterClearing theListArray.Builder.Is there a reason an empty
ListArray.Buildershouldn't always initialize withValueOffsetsBufferBuilder = [0]and do similar when cleared?Thank you
Beta Was this translation helpful? Give feedback.
All reactions