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

Method Consume

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

Source from the content-addressed store, hash-verified

264 }
265
266 Status Consume(KernelContext* ctx, const ExecSpan& batch) override {
267 ARROW_ASSIGN_OR_RAISE(
268 std::shared_ptr<RecordBatch> rb,
269 batch.ToExecBatch().ToRecordBatch(input_schema, ctx->memory_pool()));
270
271 // This is similar to GroupedListImpl
272 // last array is the group id
273 const ArraySpan& groups_array_data = batch[batch.num_values() - 1].array;
274 ARROW_DCHECK_EQ(groups_array_data.offset, 0);
275 int64_t batch_num_values = groups_array_data.length;
276 const auto* batch_groups = groups_array_data.GetValues<uint32_t>(1);
277 RETURN_NOT_OK(groups.Append(batch_groups, batch_num_values));
278 values.push_back(std::move(rb));
279 num_values += batch_num_values;
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

Callers 2

AggregateUdfConsumeFunction · 0.45
HashAggregateUdfConsumeFunction · 0.45

Calls 7

ToRecordBatchMethod · 0.80
push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
memory_poolMethod · 0.45
num_valuesMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected