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

Method DecodeHelper

cpp/src/arrow/compute/row/encode_internal.h:260–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 private:
259 template <bool first_varbinary_col, class COPY_FN>
260 static inline void DecodeHelper(uint32_t start_row, uint32_t num_rows,
261 uint32_t varbinary_col_id,
262 const RowTableImpl* rows_const,
263 RowTableImpl* rows_mutable_maybe_null,
264 const KeyColumnArray* col_const,
265 KeyColumnArray* col_mutable_maybe_null,
266 COPY_FN copy_fn) {
267 // Column and rows need to be varying length
268 ARROW_DCHECK(!rows_const->metadata().is_fixed_length &&
269 !col_const->metadata().is_fixed_length);
270
271 const RowTableImpl::offset_type* row_offsets_for_batch =
272 rows_const->offsets() + start_row;
273 const uint32_t* col_offsets = col_const->offsets();
274
275 uint32_t col_offset_next = col_offsets[0];
276 for (uint32_t i = 0; i < num_rows; ++i) {
277 uint32_t col_offset = col_offset_next;
278 col_offset_next = col_offsets[i + 1];
279
280 RowTableImpl::offset_type row_offset = row_offsets_for_batch[i];
281 const uint8_t* row = rows_const->var_length_rows() + row_offset;
282
283 uint32_t offset_within_row;
284 uint32_t length;
285 if (first_varbinary_col) {
286 rows_const->metadata().first_varbinary_offset_and_length(row, &offset_within_row,
287 &length);
288 } else {
289 rows_const->metadata().nth_varbinary_offset_and_length(
290 row, varbinary_col_id, &offset_within_row, &length);
291 }
292
293 row_offset += offset_within_row;
294
295 const uint8_t* src;
296 uint8_t* dst;
297 src = rows_const->var_length_rows() + row_offset;
298 dst = col_mutable_maybe_null->mutable_data(2) + col_offset;
299 copy_fn(dst, src, length);
300 }
301 }
302 template <bool first_varbinary_col>
303 static void DecodeImp(uint32_t start_row, uint32_t num_rows, uint32_t varbinary_col_id,
304 const RowTableImpl& rows, KeyColumnArray* col);

Callers

nothing calls this directly

Calls 3

metadataMethod · 0.45
offsetsMethod · 0.45
mutable_dataMethod · 0.45

Tested by

no test coverage detected