scovich commented on issue #7870:
URL: https://github.com/apache/arrow-rs/issues/7870#issuecomment-3038869064

   > I think an important usecase for `VariantBuilder` is to convert a column 
of an existing type (e.g. json strings, ints, etc) into a column of varaint 
values. 
   
   > Maybe in addition to the `metadata` and `values`, `VariantBuilder` itself 
should store the offsets of each of the created variants 🤔
   
   ... that could work, but only if it _also_ creates one metadata dictionary 
per variant value and tracks _those_ offsets as well:
   
   > The one thing `VariantBuilder` _does_ provide is the handling of separate 
metadata + value buffers. But that just proves the current "append as many 
values as you like" API is incorrect -- each top-level variant value in a 
column of variant values needs its own metadata value -- not one aggregate 
metadata value for the whole column.
   
   ... at which point it's no longer meaningful to provide a `finish` method. 
Instead, an `into_parts` method would consume `self` and return all four 
building blocks, which a caller could then assemble into a `StructArray` of 
`BinaryArray`. Careful tho -- `BinaryArray` uses `i32` offsets while variant 
uses `u32`!


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to