MCPcopy Create free account
hub / github.com/apache/arrow / UpdateRowLengths

Method UpdateRowLengths

cpp/src/arrow/csv/writer.cc:126–146  ·  view source on GitHub ↗

Adds the number of characters each entry in data will add to to elements in row_lengths.

Source from the content-addressed store, hash-verified

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.

Callers 1

TranslateMinimalBatchMethod · 0.45

Calls 10

is_large_binary_likeFunction · 0.85
CastFunction · 0.85
ValueOrDieMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
CastOptionsClass · 0.50
set_use_threadsMethod · 0.45
typeMethod · 0.45
idMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected