| 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 |