icexelloss commented on code in PR #35514:
URL: https://github.com/apache/arrow/pull/35514#discussion_r1194334448
##########
python/pyarrow/src/arrow/python/udf.cc:
##########
@@ -101,6 +126,97 @@ struct PythonTableUdfKernelInit {
UdfWrapperCallback cb;
};
+ struct PythonUdfScalarAggregatorImpl : public ScalarUdfAggregator {
+
+ PythonUdfScalarAggregatorImpl(UdfWrapperCallback agg_cb,
+ std::shared_ptr<OwnedRefNoGIL> agg_function,
+ std::vector<std::shared_ptr<DataType>> input_types,
+ std::shared_ptr<DataType> output_type):
+ agg_cb(agg_cb),
+ agg_function(agg_function),
+ output_type(output_type) {
+ std::vector<std::shared_ptr<Field>> fields;
+ for (size_t i = 0; i < input_types.size(); i++) {
+ fields.push_back(field("", input_types[i]));
+ }
+ input_schema = schema(fields);
+ };
+
+ ~PythonUdfScalarAggregatorImpl() {
+ if (_Py_IsFinalizing()) {
+ agg_function->detach();
+ }
+ }
+
+ Status Consume(compute::KernelContext* ctx, const compute::ExecSpan&
batch) {
+ num_rows = batch.length;
+ ARROW_ASSIGN_OR_RAISE(auto rb,
batch.ToExecBatch().ToRecordBatch(input_schema, ctx->memory_pool()));
Review Comment:
Limitation: Needing twice of the memory to concat
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]