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

Method Open

be/src/exec/unnest-node.cc:130–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130Status UnnestNode::Open(RuntimeState* state) {
131 DCHECK(IsInSubplan());
132 // Omit ScopedOpenEventAdder since this is always in a subplan.
133 SCOPED_TIMER(runtime_profile_->total_time_counter());
134 RETURN_IF_ERROR(ExecNode::Open(state));
135
136 DCHECK(containing_subplan_->current_row() != nullptr);
137 longest_collection_size_ = 0;
138 for (int i = 0; i < coll_values_.size(); ++i) {
139 Tuple* tuple =
140 containing_subplan_->current_input_row_->GetTuple((*input_coll_tuple_idxs_)[i]);
141 if (tuple != nullptr) {
142 SlotDescriptor* coll_slot_desc = (*coll_slot_descs_)[i];
143 coll_values_[i] = reinterpret_cast<const CollectionValue*>(
144 tuple->GetSlot(coll_slot_desc->tuple_offset()));
145 // Projection: Set the slot containing the collection value to nullptr.
146 tuple->SetNull(coll_slot_desc->null_indicator_offset());
147
148 // Update stats. Only take into account non-empty collections.
149 int num_tuples = coll_values_[i]->num_tuples;
150 if (num_tuples > 0) {
151 longest_collection_size_ = std::max(longest_collection_size_,
152 (int64_t)num_tuples);
153 total_collection_size_ += num_tuples;
154 ++num_collections_;
155 max_collection_size_ = std::max(max_collection_size_, (int64_t)num_tuples);
156 if (min_collection_size_ == -1 || num_tuples < min_collection_size_) {
157 min_collection_size_ = num_tuples;
158 }
159 }
160 } else {
161 coll_values_[i] = &EMPTY_COLLECTION_VALUE;
162 DCHECK_EQ(coll_values_[i]->num_tuples, 0);
163 }
164 }
165
166 COUNTER_SET(num_collections_counter_, num_collections_);
167 COUNTER_SET(avg_collection_size_counter_,
168 static_cast<double>(total_collection_size_) / num_collections_);
169 COUNTER_SET(max_collection_size_counter_, max_collection_size_);
170 COUNTER_SET(min_collection_size_counter_, min_collection_size_);
171 return Status::OK();
172}
173
174Status UnnestNode::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) {
175 SCOPED_TIMER(runtime_profile_->total_time_counter());

Callers

nothing calls this directly

Calls 9

maxFunction · 0.85
OKFunction · 0.85
total_time_counterMethod · 0.80
tuple_offsetMethod · 0.80
SetNullMethod · 0.80
current_rowMethod · 0.45
sizeMethod · 0.45
GetTupleMethod · 0.45
GetSlotMethod · 0.45

Tested by

no test coverage detected