On Thu, Oct 24, 2019 at 10:01 AM Micah Kornfield <emkornfi...@gmail.com> wrote:
> As part a PR Ji Liu has made to help populate data for test cases [1], the > question came up on whether we should provide a more builder classes in > java for ValueVectors. The proposed implementation would wrap the existing > Writer classes. > > Do people think this would be a valuable addition to the java library? I > imagine it would be a builder per ValueVectorType. The main benefit I see > to this is making the library potentially slightly easier to use for > new-comers, but might not be the most efficient. A straw-man interface is > listed below. > > Thoughts? > I can see that it makes writing tests easier, and ease-of-use (esp. handling the setSafe/setValueCount). In dremio, we mostly populate value vectors either : - from arrow buffers (eg. read from parquet) - from other value vectors (eg. selection vector removal or transfers) - directly populate the constituent arrow buffers (eg. gandiva) so, we haven't had a need for explicit builders. > > Thanks, > Micah > > class IntVectorBuilder { > public IntVectorBuilder(BufferAllocator allocator); > > IntVectorBuilder add(int value); > IntVectorBuilder addAll(int[] values); > IntVectorBuilder addNull(); > // handles null values in array > IntVectorBuilder addAll(Integer... values); > IntVectorBuilder addAll(List<Integer> values); > IntVector build(String name); > } > -- Thanks and regards, Ravindra.