Filtering happens after group_by repartitioning

オープン
#553 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
kafka, python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
Python
スター
1.9k
フォーク
205
平均マージ
2時間 2分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

faust-streaming/faust のほかの issue

faust-streaming/faust の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。