arrow-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes McKinney <wesmck...@gmail.com>
Subject Re: Row-Wise Tutorial: UB?
Date Tue, 09 Oct 2018 09:08:18 GMT
hi Caleb -- this tutorial has fallen out of date. The child builder in
0.10 and 0.11 is now a shared_ptr
https://github.com/apache/arrow/blob/master/cpp/src/arrow/builder.h#L798

I'm opening an issue to fix the tutorial -- such is the peril of
tutorials that we don't compile
https://issues.apache.org/jira/browse/ARROW-3470

thanks
Wes
On Mon, Oct 8, 2018 at 8:07 PM Caleb Epstein <caleb.epstein@gmail.com> wrote:
>
> Re: https://arrow.apache.org/docs/cpp/md_tutorials_row_wise_conversion.html
>
> The example code suggests you do the following (eliding some lines for brevity):
>
> std::unique_ptr<DoubleBuilder> components_values_builder(new DoubleBuilder(pool));
> ListBuilder components_builder(pool, std::move(components_values_builder));
>
> But then:
>
> for (const data_row& row : rows) {
> [...]
> ARROW_RETURN_NOT_OK(components_values_builder->Append(
> row.cost_components.data(), row.cost_components.size(),
> nullptr);
> }
>
>
>
> Given that components_values_builder has been moved-from above, won't this be UB, likely
crashing your app? Is there a more correct way to write this?

Mime
View raw message