apache / apache/arrow

[C++][Python] UDF Integration

Open
#31,094 5 comments 0 reactions 0 assignees View on GitHub
Component: C++ Component: Python Type: task
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 18h
Merged PRs (30d)
91

Description

The objective is to list down a set of tasks required to provide UDF support for Apache Arrow streaming execution engine. In the first iteration we will be focusing on providing support for Python-based UDFs which can support Python functions. 

The UDF Integration is going to pan out with a series of sub-tasks associated with the development and PoCs. Note that this is going to be the first iteration of UDF integrations with a limited scope. This ticket will cover the following topics;
1. POC for UDF integration: The objective is to evaluate the existing components in the source and evaluate the required modifications and new building blocks required to integrate UDFs.
1. The language will be limited to C+{}/{}Python users can register Python function as a UDF and use it with an `apply` method on Arrow Tables or provide a computation API endpoint via arrow::compute API. Note that the C+ API already provides a way to register custom functions via the function registry API. At the moment this is not exposed to Python. 
1. Planned features for this ticket are;
1. Scalar UDFs : UDFs executed per value (per row)
1. Vector UDFs : UDFs executed per batch (a full array or partial array)
1. Aggregate UDFs : UDFs associated with an aggregation operation
1. Integration limitations
1. Doesn't support custom data types which doesn't support Numpy or Pandas
1. Complex processing with parallelism within UDFs are not supported
1. Parallel UDFs are not supported in the initial version of UDFs. Allthough we are documenting what is required and a rough sketch for the next phase. 

**Reporter**: [Vibhatha Lakmal Abeykoon](https://issues.apache.org/jira/browse/ARROW-15635) / @vibhatha
**Assignee**: [Vibhatha Lakmal Abeykoon](https://issues.apache.org/jira/browse/ARROW-15635) / @vibhatha
#### Subtasks:
- [ ] [PoC for UDFs ](https://github.com/apache/arrow/issues/31095)
- [ ] [[C++][Python] UDF Optimizations](https://github.com/apache/arrow/issues/31096)
- [ ] [[Docs] UDF Documentation](https://github.com/apache/arrow/issues/31097)
- [X] [[C++][Python] UDF Scalar Function Implementation ](https://github.com/apache/arrow/issues/20111)
- [ ] [[Docs] UDFs on Cookbook](https://github.com/apache/arrow/issues/31098)
- [ ] [[C++][Python] UDF Aggregate Function Implementation](https://github.com/apache/arrow/issues/31099)
- [ ] [[C++][Python] UDF Vector Function Implementation ](https://github.com/apache/arrow/issues/31103)
- [ ] [[C++][Python] Include UDFOptions](https://github.com/apache/arrow/issues/31460)
- [ ] [[C++][Python] Unregister compute functions](https://github.com/apache/arrow/issues/31611)
- [ ] [[C++][Python] Register Multiple Kernels for a UDF](https://github.com/apache/arrow/issues/31612)
- [ ] [[C++][Python] Generate scalar-argument kernel based on array-argument kernel for UDFs](https://github.com/apache/arrow/issues/31613)
- [X] [[Docs][Python] Scalar UDF Experimental Documentation](https://github.com/apache/arrow/issues/20335)
- [ ] [[Python] Allow calling UDF kernels with field/scalar expressions](https://github.com/apache/arrow/issues/33048)
- [ ] [[C++][Python] Implement HashAggregate UDF ](https://github.com/apache/arrow/issues/33457)
#### PRs and other links:
- [GitHub Pull Request #13214](https://github.com/apache/arrow/pull/13214)

**Note**: *This issue was originally created as [ARROW-15635](https://issues.apache.org/jira/browse/ARROW-15635). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing source components and the C++ function registry API mentioned in the issue, along with the arrow::compute API and Python apply entry points. Done means producing the proposed UDF integration proof of concept and documenting the required building blocks and limitations for the listed scalar, vector, and aggregate cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.