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

Method NumRowsToSkip

cpp/src/arrow/compute/light_array_internal.cc:367–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367int ExecBatchBuilder::NumRowsToSkip(const std::shared_ptr<ArrayData>& column,
368 int num_rows, const uint16_t* row_ids,
369 int num_tail_bytes_to_skip) {
370#ifndef NDEBUG
371 // Ids must be in non-decreasing order
372 //
373 for (int i = 1; i < num_rows; ++i) {
374 ARROW_DCHECK(row_ids[i] >= row_ids[i - 1]);
375 }
376#endif
377
378 KeyColumnMetadata column_metadata =
379 ColumnMetadataFromDataType(column->type).ValueOrDie();
380 ARROW_DCHECK(!column_metadata.is_fixed_length || column_metadata.fixed_length > 0);
381
382 int num_rows_left = num_rows;
383 int num_bytes_skipped = 0;
384 while (num_rows_left > 0 && num_bytes_skipped < num_tail_bytes_to_skip) {
385 --num_rows_left;
386 int row_id_removed = row_ids[num_rows_left];
387 if (column_metadata.is_fixed_length) {
388 num_bytes_skipped += column_metadata.fixed_length;
389 } else {
390 const int32_t* offsets = column->GetValues<int32_t>(1);
391 num_bytes_skipped += offsets[row_id_removed + 1] - offsets[row_id_removed];
392 }
393 // Skip consecutive rows with the same id
394 while (num_rows_left > 0 && row_id_removed == row_ids[num_rows_left - 1]) {
395 --num_rows_left;
396 }
397 }
398
399 return num_rows - num_rows_left;
400}
401
402template <bool OUTPUT_BYTE_ALIGNED>
403void ExecBatchBuilder::CollectBitsImp(const uint8_t* input_bits,

Callers

nothing calls this directly

Calls 2

ValueOrDieMethod · 0.80

Tested by

no test coverage detected