MCPcopy Create free account
hub / github.com/apache/impala / TotalByteSize

Method TotalByteSize

be/src/runtime/row-batch.cc:444–473  ·  view source on GitHub ↗

TODO: consider computing size of batches as they are built up

Source from the content-addressed store, hash-verified

442
443// TODO: consider computing size of batches as they are built up
444int64_t RowBatch::TotalByteSize(DedupMap* distinct_tuples) {
445 DCHECK(distinct_tuples == nullptr || distinct_tuples->size() == 0);
446 int64_t result = 0;
447 vector<int> tuple_count(row_desc_->tuple_descriptors().size(), 0);
448
449 // Sum total variable length byte sizes.
450 for (int i = 0; i < num_rows_; ++i) {
451 for (int j = 0; j < num_tuples_per_row_; ++j) {
452 Tuple* tuple = GetRow(i)->GetTuple(j);
453 if (UNLIKELY(tuple == nullptr)) continue;
454 // Only count the data of unique tuples.
455 if (LIKELY(i > 0) && UNLIKELY(GetRow(i - 1)->GetTuple(j) == tuple)) {
456 // Fast tuple deduplication for adjacent rows.
457 continue;
458 } else if (UNLIKELY(distinct_tuples != nullptr)) {
459 if (row_desc_->tuple_descriptors()[j]->byte_size() == 0) continue;
460 bool inserted = distinct_tuples->InsertIfNotPresent(tuple, -1);
461 if (!inserted) continue;
462 }
463 result += tuple->VarlenByteSize(
464 *row_desc_->tuple_descriptors()[j], true /*assume_smallify*/);
465 ++tuple_count[j];
466 }
467 }
468 // Compute sum of fixed component of tuple sizes.
469 for (int j = 0; j < num_tuples_per_row_; ++j) {
470 result += row_desc_->tuple_descriptors()[j]->byte_size() * tuple_count[j];
471 }
472 return result;
473}
474
475Status RowBatch::ResizeAndAllocateTupleBuffer(
476 RuntimeState* state, int64_t* buffer_size, uint8_t** buffer) {

Callers

nothing calls this directly

Calls 5

InsertIfNotPresentMethod · 0.80
VarlenByteSizeMethod · 0.80
sizeMethod · 0.45
GetTupleMethod · 0.45
byte_sizeMethod · 0.45

Tested by

no test coverage detected