Adds the number of characters each entry in data will add to to elements in row_lengths.
| 124 | // Adds the number of characters each entry in data will add to to elements |
| 125 | // in row_lengths. |
| 126 | Status UpdateRowLengths(const Array& data, int64_t* row_lengths) { |
| 127 | compute::ExecContext ctx(pool_); |
| 128 | // Populators are intented to be applied to reasonably small data. In most cases |
| 129 | // threading overhead would not be justified. |
| 130 | ctx.set_use_threads(false); |
| 131 | if (data.type() && is_large_binary_like(data.type()->id())) { |
| 132 | ARROW_ASSIGN_OR_RAISE(array_, compute::Cast(data, /*to_type=*/large_utf8(), |
| 133 | compute::CastOptions(), &ctx)); |
| 134 | } else { |
| 135 | auto casted = compute::Cast(data, /*to_type=*/utf8(), compute::CastOptions(), &ctx); |
| 136 | if (casted.ok()) { |
| 137 | array_ = std::move(casted).ValueOrDie(); |
| 138 | } else if (casted.status().IsCapacityError()) { |
| 139 | ARROW_ASSIGN_OR_RAISE(array_, compute::Cast(data, /*to_type=*/large_utf8(), |
| 140 | compute::CastOptions(), &ctx)); |
| 141 | } else { |
| 142 | return casted.status(); |
| 143 | } |
| 144 | } |
| 145 | return UpdateRowLengths(row_lengths); |
| 146 | } |
| 147 | |
| 148 | // Places string data onto each row in output and updates the corresponding row |
| 149 | // pointers in preparation for calls to other (next) ColumnPopulators. |
no test coverage detected