Decode Python UDFs opaquely so a scheduler needs no Python interpreter
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend, distributed-systems
Línea de trabajo
Empieza leyendo crates/core/src/codec.rs y el trabajo del codec de extensiones de #1678 para entender el formato wire de DFPYUDF y la composición de codecs. Diseña el ScalarUDFImpl y el codec del lado del scheduler alrededor del payload existente, conservando los bytes de cloudpickle durante la recodificación y exponiendo metadatos recuperables, y haz que invoke devuelva un error. Comprueba el contexto de dependencias en #1703.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In a distributed setup the scheduler plans a query and hands stages to executors; only the executors ever call a Python UDF. Decoding an inlined Python UDF unpickles the function, which requires a Python interpreter and every module the function closes over to be importable. Doing that on the scheduler costs work nobody needs and forces the scheduler image to carry Python and the full dependency set of user code it will never run. Raised in https://github.com/apache/datafusion-python/pull/1678#pullrequestreview-5100366976.
Describe the solution you'd like
An opaque decode path: a ScalarUDFImpl that holds the still-pickled blob rather than a live Python object, and a codec that produces it. A scheduler installs that codec, decodes a plan into something it can inspect, route, and re-encode, and never touches cloudpickle. The executor installs the ordinary codec and unpickles as it does now.
The wire format already allows this. An inlined UDF payload is DFPYUDF followed by a version byte and the cloudpickle blob (crates/core/src/codec.rs), so an opaque holder can carry those bytes verbatim and no format change is needed.
The part that needs design is re-encoding. A scheduler that forwards a stage has to emit the blob byte-identically, so the executor sees exactly what the client wrote. That also raises what such a UDF should report for the things DataFusion asks of a ScalarUDFImpl during planning — name, signature, and return type are all recoverable from the payload without unpickling, since they are stored alongside the function, but invoke has to be an error rather than a surprise.
Describe alternatives you've considered
Encoding Python UDFs by name only and registering them on every node. Already supported and appropriate when the function is available everywhere; it does not cover the case inlining exists for, which is a function the receiving process does not have.
Having the scheduler unpickle and immediately drop the object. Keeps the code simple, and still requires Python plus all user dependencies on the scheduler, which is the actual cost being avoided.
Additional context
Follow-up from #1678, which made extension codecs compose so a setup like this can install a scheduler-side codec alongside others. Likely also depends on #1703, gating pyo3/extension-module, if the consumer is a Rust crate rather than a Python process.
- 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/datafusion-python
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion-python#1726 ·
-
Dificultad 2/5 Medio día Aptitud para principiantes 88/100
apache/datafusion-python#1691 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-python#1644 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
apache/datafusion-python#1737 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 76/100
apache/datafusion-python#1735 · 1 comentario ·
Todos los issues de apache/datafusion-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
learningequality/ricecooker#747 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
run-llama/llama_index#23199 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
KhronosGroup/glTF-Blender-IO#2769 ·