Expose SessionContext.register_higher_order_function / deregister_higher_order_function (v54)

Abierto
#1,572 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
python, rust
Área
api

Línea de trabajo

Comienza leyendo el PR #1561 y las firmas de registro de SessionContext en upstream para HigherOrderFunctionImpl y Expr. Define la API orientada a Python para registrar y dar de baja funciones higher-order personalizadas, incluido cómo invoke devuelve un Expr; se considera terminado cuando la superficie de registro de v54 está expuesta y es utilizable por los autores de bibliotecas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Background

DataFusion 54 introduced first-class higher-order functions (HOFs) that take lambdas plus collection arguments and rewrite to a scalar Expr at planning time. PR #1561 exposed Python lambda syntax and the built-in HOFs (array_transform, array_filter, array_any_match, etc.) but did not expose the registration API for custom HOFs.

Upstream signature

pub fn register_higher_order_function(&self, func: Arc<dyn HigherOrderFunctionImpl>)
pub fn deregister_higher_order_function(&self, name: &str) -> Option<Arc<dyn HigherOrderFunctionImpl>>

HigherOrderFunctionImpl trait requires name(), args_count() (min, max), and invoke(&self, args: &[Expr]) -> Result<Expr>.

User value

Lets library authors add lambda-aware operators that are not in DataFusion's built-in set. Examples: array_window(arr, size, x -> ...), array_partition_by(arr, x -> key(x)), array_zip_with(a, b, (x, y) -> x * y), or domain-specific operators on JSON / graph / geo arrays. The HOF runs at logical-plan time, rewriting lambda + args into a standard Expr tree the planner optimizes -- not equivalent to a ScalarUDF.

Why deferred

Effort estimate is medium-large (~350-550 LOC) and the authoring cost is high for end users: the invoke callback must return a DataFusion Expr tree from Python, which requires familiarity with the Expr grammar. Most array-lambda needs are already covered by the built-in HOFs PR #1561 ships. No open user requests at the time of audit. Filed for tracking to complete the v54 HOF surface symmetrically once a concrete use case or extension-library ecosystem emerges.

Lenguaje dominante
Python
Estrellas
605
Forks
176
Merge medio
1 d 23 h
PR fusionados (30 d)
8

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/datafusion-python

Todos los issues de apache/datafusion-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.