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

Method Merge

python/pyarrow/src/arrow/python/udf.cc:282–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 return Status::OK();
281 }
282 Status Merge(KernelContext* ctx, KernelState&& other_state,
283 const ArrayData& group_id_mapping) override {
284 // This is similar to GroupedListImpl
285 auto& other = checked_cast<PythonUdfHashAggregatorImpl&>(other_state);
286 auto& other_values = other.values;
287 const uint32_t* other_raw_groups = other.groups.data();
288 values.insert(values.end(), std::make_move_iterator(other_values.begin()),
289 std::make_move_iterator(other_values.end()));
290
291 auto g = group_id_mapping.GetValues<uint32_t>(1);
292 for (uint32_t other_g = 0; static_cast<int64_t>(other_g) < other.num_values;
293 ++other_g) {
294 // Different state can have different group_id mappings, so we
295 // need to translate the ids
296 RETURN_NOT_OK(groups.Append(g[other_raw_groups[other_g]]));
297 }
298
299 num_values += other.num_values;
300 return Status::OK();
301 }
302
303 Status Finalize(KernelContext* ctx, Datum* out) override {
304 // Exclude the last column which is the group id

Callers 1

HashAggregateUdfMergeFunction · 0.45

Calls 6

OKFunction · 0.50
dataMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected