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

Method AddIntermediateTuple

be/src/exec/grouping-aggregator-ir.cc:139–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138template <bool AGGREGATED_ROWS>
139Status GroupingAggregator::AddIntermediateTuple(Partition* __restrict__ partition,
140 TupleRow* __restrict__ row, uint32_t hash, HashTable::Iterator insert_it,
141 bool has_more_rows) {
142 while (true) {
143 DCHECK(partition->aggregated_row_stream->is_pinned());
144 Tuple* intermediate_tuple = ConstructIntermediateTuple(partition->agg_fn_evals,
145 partition->aggregated_row_stream.get(), &add_batch_status_);
146
147 if (LIKELY(intermediate_tuple != nullptr)) {
148 UpdateTuple(
149 partition->agg_fn_evals.data(), intermediate_tuple, row, AGGREGATED_ROWS);
150 // After copying and initializing the tuple, insert it into the hash table.
151 insert_it.SetTuple(intermediate_tuple, hash);
152 return Status::OK();
153 } else if (!add_batch_status_.ok()) {
154 return std::move(add_batch_status_);
155 }
156
157 // If we don't need to reserve extra space for the serialize stream, restore them
158 // before spilling any partitions. One case is we don't need the serialize stream at
159 // all. The other case is this is the last row to add, and 'partition' will be read
160 // out and closed after adding this row, so no partitions need to be spilled.
161 if ((!needs_serialize_ || !has_more_rows)
162 && large_write_page_reservation_.GetReservation() > 0) {
163 RestoreLargeWritePageReservation();
164 continue;
165 }
166
167 // We did not have enough memory to add intermediate_tuple to the stream.
168 RETURN_IF_ERROR(SpillPartition(AGGREGATED_ROWS));
169 if (partition->is_spilled()) {
170 return AppendSpilledRow<AGGREGATED_ROWS>(partition, row);
171 }
172 }
173}
174
175Status GroupingAggregator::AddBatchStreamingImpl(int agg_idx, bool needs_serialize,
176 TPrefetchMode::type prefetch_mode, RowBatch* in_batch, RowBatch* out_batch,

Callers

nothing calls this directly

Calls 9

OKFunction · 0.85
moveFunction · 0.85
getMethod · 0.65
is_pinnedMethod · 0.45
dataMethod · 0.45
SetTupleMethod · 0.45
okMethod · 0.45
GetReservationMethod · 0.45
is_spilledMethod · 0.45

Tested by

no test coverage detected