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

Method AppendSpilledRow

be/src/exec/grouping-aggregator.cc:598–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596
597template <bool AGGREGATED_ROWS>
598Status GroupingAggregator::AppendSpilledRow(
599 Partition* __restrict__ partition, TupleRow* __restrict__ row) {
600 DCHECK(!is_streaming_preagg_);
601 DCHECK(partition->is_spilled());
602 BufferedTupleStream* stream = AGGREGATED_ROWS ?
603 partition->aggregated_row_stream.get() :
604 partition->unaggregated_row_stream.get();
605 DCHECK(!stream->is_pinned());
606 Status status;
607 if (LIKELY(AddRowToSpilledStream(stream, row, &status))) return Status::OK();
608 RETURN_IF_ERROR(status);
609
610 // Keep trying to free memory by spilling and retry AddRow() until we run out of
611 // partitions or hit an error.
612 for (int n = GetNumPinnedPartitions(); n > 0; --n) {
613 RETURN_IF_ERROR(SpillPartition(AGGREGATED_ROWS));
614 if (LIKELY(AddRowToSpilledStream(stream, row, &status))) return Status::OK();
615 RETURN_IF_ERROR(status);
616 }
617 // If we have spilled all partitions, we should be able to add the row use the large
618 // write page reservation. This indicates a bug that we can't work in min reservation.
619 return Status(TErrorCode::INTERNAL_ERROR, Substitute("Internal error: No reservation "
620 "for writing a large page even after all partitions are spilled in $0:\n$1",
621 DebugString(), buffer_pool_client()->DebugString()));
622}
623
624void GroupingAggregator::SetDebugOptions(const TDebugOptions& debug_options) {
625 debug_options_ = debug_options;

Callers

nothing calls this directly

Calls 8

OKFunction · 0.85
SubstituteFunction · 0.85
StatusClass · 0.70
getMethod · 0.65
DebugStringFunction · 0.50
is_spilledMethod · 0.45
is_pinnedMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected