[Bug]: [Python] ReadFromAvro(as_rows=True) fails on Avro logical types (timestamp, date, decimal, uuid)
Los mantenedores suelen responder en 2 días
Evaluación
Este issue todavía no se ha evaluado.
Descripción
What happened?
ReadFromAvro(..., as_rows=True) fails on any Avro field that has a logical type. BigQuery Avro exports hit this: every TIMESTAMP column is written as {"type": "long", "logicalType": "timestamp-micros"}.
This was reported in #31656 (timestamp-millis), which the stale bot closed. It still fails on master (38eed1e5da0) and 2.78.0, and it affects every logical type, not only timestamps:
| Avro logical type | Error with as_rows=True |
|---|---|
| timestamp-millis, timestamp-micros, date, time-millis, local-timestamp-millis | TypeError: an integer is required |
| uuid | AttributeError: 'UUID' object has no attribute 'encode' |
| decimal | TypeError: Expected bytes, got decimal.Decimal |
Reading the same file without as_rows works. Beam YAML's ReadFromAvro sets as_rows: True by default (standard_io.yaml), so a YAML pipeline can't read any Avro file with such a column.
Cause: avro_type_to_beam_type ignores logicalType and maps the field to its primitive (INT64, INT32, BYTES, STRING), but fastavro decodes logical types to Python objects (datetime, date, Decimal, UUID), so the RowCoder gets a value that doesn't match the schema.
Repro:
import datetime, tempfile, os, fastavro
import apache_beam as beam
schema = {"type": "record", "name": "T", "fields": [
{"name": "ts", "type": {"type": "long", "logicalType": "timestamp-micros"}}]}
path = os.path.join(tempfile.mkdtemp(), "t.avro")
with open(path, "wb") as f:
fastavro.writer(f, fastavro.parse_schema(schema),
[{"ts": datetime.datetime.now(datetime.timezone.utc)}])
with beam.Pipeline() as p:
p | beam.io.ReadFromAvro(path, as_rows=True) | beam.Map(print)
# TypeError: an integer is required [while running 'ReadFromAvro/Map(<lambda at avroio.py:676>)']
Proposed fix (I have it ready with a test): map logical types to the Beam types the Java SDK's AvroUtils uses, through the existing Python logical types: timestamp-millis/micros → Timestamp (micros_instant), date → datetime.date, decimal → decimal.Decimal, uuid → str. Logical types with no Beam equivalent in Python (time-, local-timestamp-) fall back to Any, as unions already do in this file.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
- Component: Python SDK
- Component: IO connector
Found, reproduced and drafted with Claude Code (Claude Opus 5.5).
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 4.8k
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 445
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/beam
-
awaiting triage java new feature P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorPosiblemente ocupada @shikhabhadoria la tomó hace 6 días. Abiertoio P2 python
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/beam#41346 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Release notes links wrongPosiblemente ocupada @schizophrenicmaniac la tomó hace 20 días. Abiertobug P3
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
apache/beam#41197 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/beam#39624 · 2 reacciones ·
Los mantenedores suelen responder en 2 días
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizePosiblemente ocupada @1fanwang la tomó hace 98 días. Abiertobug io P3 pinned pubsub
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/beam#28011 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/beam
Issues similares
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPosiblemente ocupada @trivikr la tomó hoy. Abiertocli
Dificultad 2/5 1-3 horas Aptitud para principiantes 81/100
eclipse-openvsx/openvsx#2482 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
32x and 48x Item Model IssuesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Magic-team-jvav/confluence#281 ·
-
CVE-2026-139999 react-routerAbiertoarea/dependencies area/dependencies/js backport/26.6 backport/26.8 kind/cve severity/medium source/scan-dependencies status/triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
Los mantenedores suelen responder en 2 días
-
[DEFECT] AsciiDoc builders write a stray ## before every schema member when the namespace prefixes file binds the schema's own namespacePosiblemente ocupada @Beehtrix la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cimug-org/CIMTool#427 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
userRaised
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
eclipse-openj9/openj9#25285 ·
Los mantenedores suelen responder en 1 día