Stream.group_by don't support schema

Aberta
#552 3 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
18/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
kafka, python

Direção de pesquisa

Start from the Stream.group_by call in the reproduction, where the agent's custom schema is lost when the internal topic is created for key grouping. Read how that internal topic gets its deserializer, then check whether a schema passed to group_by would reach it. Done means event.value arrives as the custom record type rather than str in the reproduction; the issue has no linked pull request and no maintainer decision yet, so confirm the design with maintainers first.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

I have an agent that uses a custom schema. Also, the agent groups messages by key before processing them.

The issue is due to the internal topic created by the method stream.group_by.
This internal topic doesn't deserialize the message properly.

The solution could be to pass this schema through an argument to the method Stream.group_by.

Expected behavior

async def get_key(value):
        return value.id

@app.agent(schema=CustomSchema())
async def counter(stream):
    """ Count records. """
    async for event in stream.group_by(get_key, name='count').events():
        
        ## the type of event.value should be MyRecord, instead of str
        
        yield event

Actual behavior

This internal topic created by Stream.group_by doesn't deserialize the message properly.

Versions

  • Python version: 3.10
  • Faust version: 0.10.16
Linguagem predominante
Python
Estrelas
1.9k
Forks
205
Merge médio
2h 2min
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de faust-streaming/faust

Todas as issues de faust-streaming/faust

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.