Hi John, In addition to Micah’s reply, does the member method Value(int64_t i)[1][2][3] satisfy your need? It is defined for all array types with a primitive value representation, i.e. all primitive arrays and binary arrays.
[1] https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_primitive.h#L50 <https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_primitive.h#L50> [2] https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_primitive.h#L109 <https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_primitive.h#L109> [3] https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_binary.h#L87 <https://github.com/js8544/arrow/blob/master/cpp/src/arrow/array/array_binary.h#L87> > 2022年11月15日 13:06,Micah Kornfield <emkornfi...@gmail.com> 写道: > > Hi John, > > There are a couple of edge cases that need to be discussed to move the > function to the base array class (which IIUC is this proposal): > 1. boolean > 2. struct > 3. lists/LargeList > 4. DictionaryArray > > FlatArray [1] seems like a better place for this method if there is > consensus on adding it. > > Cheers, > Micah > > [1] > https://github.com/apache/arrow/blob/master/cpp/src/arrow/array/array_base.h#L219 > > On Mon, Nov 14, 2022 at 11:46 AM John Muehlhausen <j...@jgm.org> wrote: > >> There exists: >> const uint8_t* BaseBinaryArray::GetValue(int64_t i, offset_type* >> out_length) const >> >> What about adding: >> const uint8_t* Array::GetValue(int64_t i, offset_type* out_length) const >> >> This would allow GetValue to get the untyped bytes/length of any value? >> E.g. out_length would be set to sizeof(T) for arrays of primitive type T? >> >> For FixedSizeBinaryArray the existing GetValue would still be a valid >> overload. >> >> -John >>