You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Rares Vernica <rv...@gmail.com> on 2021/07/27 15:57:02 UTC

C++ Datum::move returns ArrayData not Array

Hi,

I'm trying the example in the Compute Functions user guide
https://arrow.apache.org/docs/cpp/compute.html#invoking-functions

std::shared_ptr<arrow::Array> numbers_array =
...;std::shared_ptr<arrow::Scalar> increment = ...;arrow::Datum
incremented_datum;
ARROW_ASSIGN_OR_RAISE(incremented_datum,
                      arrow::compute::CallFunction("add",
{numbers_array, increment}));std::shared_ptr<Array> incremented_array
= std::move(incremented_datum).array();

and I'm getting this compilation error:

error: conversion from 'const std::shared_ptr<arrow::ArrayData>' to
non-scalar type 'std::shared_ptr<scidb::Array>' requested
         std::shared_ptr<Array> incremented_array =
std::move(incremented_datum).array();

I'm using Arrow 3.0.0. Is there a conversion I can make from ArrowData to
Arrow. I need the result to be Arrow because I'm adding it as a new column
to a RecordBatch using AddColumn.

Thanks!
Rares

Re: C++ Datum::move returns ArrayData not Array

Posted by Benjamin Kietzman <be...@gmail.com>.
Opened https://issues.apache.org/jira/browse/ARROW-13462
to track correction of the doc's examples

On Tue, Jul 27, 2021 at 11:59 AM Benjamin Kietzman <be...@gmail.com>
wrote:

> Sorry, that is a typo. I will open a JIRA to fix the doc.
>
> In the meantime, incremented_datum.make_array() should work for you
>
> On Tue, Jul 27, 2021, 11:57 Rares Vernica <rv...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm trying the example in the Compute Functions user guide
>> https://arrow.apache.org/docs/cpp/compute.html#invoking-functions
>>
>> std::shared_ptr<arrow::Array> numbers_array =
>> ...;std::shared_ptr<arrow::Scalar> increment = ...;arrow::Datum
>> incremented_datum;
>> ARROW_ASSIGN_OR_RAISE(incremented_datum,
>>                       arrow::compute::CallFunction("add",
>> {numbers_array, increment}));std::shared_ptr<Array> incremented_array
>> = std::move(incremented_datum).array();
>>
>> and I'm getting this compilation error:
>>
>> error: conversion from 'const std::shared_ptr<arrow::ArrayData>' to
>> non-scalar type 'std::shared_ptr<scidb::Array>' requested
>>          std::shared_ptr<Array> incremented_array =
>> std::move(incremented_datum).array();
>>
>> I'm using Arrow 3.0.0. Is there a conversion I can make from ArrowData to
>> Arrow. I need the result to be Arrow because I'm adding it as a new column
>> to a RecordBatch using AddColumn.
>>
>> Thanks!
>> Rares
>>
>

Re: C++ Datum::move returns ArrayData not Array

Posted by Benjamin Kietzman <be...@gmail.com>.
Sorry, that is a typo. I will open a JIRA to fix the doc.

In the meantime, incremented_datum.make_array() should work for you

On Tue, Jul 27, 2021, 11:57 Rares Vernica <rv...@gmail.com> wrote:

> Hi,
>
> I'm trying the example in the Compute Functions user guide
> https://arrow.apache.org/docs/cpp/compute.html#invoking-functions
>
> std::shared_ptr<arrow::Array> numbers_array =
> ...;std::shared_ptr<arrow::Scalar> increment = ...;arrow::Datum
> incremented_datum;
> ARROW_ASSIGN_OR_RAISE(incremented_datum,
>                       arrow::compute::CallFunction("add",
> {numbers_array, increment}));std::shared_ptr<Array> incremented_array
> = std::move(incremented_datum).array();
>
> and I'm getting this compilation error:
>
> error: conversion from 'const std::shared_ptr<arrow::ArrayData>' to
> non-scalar type 'std::shared_ptr<scidb::Array>' requested
>          std::shared_ptr<Array> incremented_array =
> std::move(incremented_datum).array();
>
> I'm using Arrow 3.0.0. Is there a conversion I can make from ArrowData to
> Arrow. I need the result to be Arrow because I'm adding it as a new column
> to a RecordBatch using AddColumn.
>
> Thanks!
> Rares
>