Stream.group_by don't support schema

Abierto
#552 3 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
18/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
kafka, python

Línea de trabajo

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.

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

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
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.