Filtering happens after group_by repartitioning

Aperta
#553 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
kafka, python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
Python
Stelle
1.9k
Fork
205
Merge medio
2h 2m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di faust-streaming/faust

Tutte le issue di faust-streaming/faust

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.