Also given the above code, I think a Cast operator in compute would be
pretty easy to implement and welcome addition.

On Thu, Oct 21, 2021 at 1:27 AM Micah Kornfield <[email protected]>
wrote:

> I can't answer for compute.  But something like:
>
> ```
> auto data = month_array.data();
> data->type = int32();
> auto int_array = MakeArray(data);
> ```
>
> Should work I think.
>
> On Thu, Oct 21, 2021 at 1:08 AM Matt Youill <[email protected]>
> wrote:
>
>> That was a quick reply :)
>>
>> More specifically would like to convert a monthinterval array to an int
>> array...in bulk, so ideally using a cast or similar compute function.
>>
>> I can do it manually, but just wondering if there is a cast or similar
>> mechanism in compute.
>>
>> On Thu., 21 Oct. 2021, 7:04 pm Micah Kornfield, <[email protected]>
>> wrote:
>>
>>> Hi Matt,
>>> Which language?  MonthInterval has been around for a while but has not
>>> received a lot of attention.  In C++ at least MonthIntervalArray is just a
>>> specialization of NumericArray [1], where each slot holds the number of
>>> months, so you don't really need to use compute functions to get at the
>>> value (just direct or visitor access is sufficient).
>>>
>>> -Micah
>>>
>>> [1]
>>> https://github.com/apache/arrow/blob/3317f83526cf6cfc6c749748b3e836114262a8d0/cpp/src/arrow/array/array_primitive.h#L107
>>>
>>> On Thu, Oct 21, 2021 at 12:34 AM Matt Youill <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can't seem to figure out how to work with this arrays of this type -
>>>> MonthInterval.
>>>>
>>>> Is there a way to extract the underlying int using the compute
>>>> functions? Cast? Month? Is it simply too new?
>>>>
>>>> Thanks, Matt
>>>>
>>>>

Reply via email to