Filtering happens after group_by repartitioning

Abierto
#553 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
kafka, python

Línea de trabajo

The problem sits in faust/streams.py: group_by calls chain(), which creates a new stream, so the upstream filter() ends up running in self._next after the repartition step. Start by reading the chain() and group_by code paths and how filter() is applied in the stream iteration. Done means a filter placed before group_by drops events before they reach the repartition topic, shown by a test that checks what is sent to the repartition topic. The issue has no comments or maintainer direction, so confirm the intended ordering first.

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

Descripción

Checklist

  • I have included information about relevant versions
  • I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

async for v in stream.filter(lambda: v > 1000).group_by(...):
... # do something

By using .filter with .group_by it appears that every event is sent to repartition topic, even if the event doesn't pass the filtering and filtering happens only after repartitioning is done. Thus the extra work is done.

Expected behavior

As the docs says the .filter() method should be useful for filtering events before repartitioning a stream. So the filtered events won't be sent to the repartition topic.

Actual behavior

Filtering happens after repartitioning because of the chain method inside the group_by which creates new stream and moves the.filter() process to the self._next which happens after the repartition process.

Versions

  • Python version: Python 3.10.6
  • Faust version: 0.10.14
  • Operating system: Ubuntu 22
  • Kafka version: 3.4
  • RocksDB version (if applicable)
Lenguaje dominante
Python
Estrellas
1.9k
Forks
205
Merge medio
2 h 2 min
PR fusionados (30 d)
1

Preparar el entorno

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 faust-streaming/faust

Todos los issues de faust-streaming/faust

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.