[Bug]: [Python] ReadFromParquet(as_rows=True) fails on timestamp and date columns ("Unrecognized arrow type")
Les mainteneurs répondent en général sous 2 jours
Évaluation
Cette issue n'a pas encore été évaluée.
Description
What happened?
ReadFromParquet(..., as_rows=True) fails at pipeline construction on any Parquet file that has a timestamp or date column:
ValueError: Unrecognized arrow type: TimestampType(timestamp[us])
ValueError: Unrecognized arrow type: DataType(date32[day])
Timestamp and date columns are in most real Parquet files. Every file written by pandas DataFrame.to_parquet with a datetime column has one (timestamp[ns]), so as_rows=True can't read them at all. The write side has the same gap: WriteToParquet on a schema'd PCollection with a Timestamp or datetime.date field raises NotImplementedError: Beam logical types are not currently supported in arrow_type_compatibility (the TODO for #23817).
Reproducer (master 8d4c010c727, also 2.78.0):
import datetime
import pyarrow as pa, pyarrow.parquet as pq
import apache_beam as beam
pq.write_table(pa.table({
't': pa.array([datetime.datetime(2024, 3, 1, 10)], pa.timestamp('us')),
'd': pa.array([datetime.date(2024, 3, 1)], pa.date32()),
}), 'ts.parquet')
with beam.Pipeline() as p:
p | beam.io.ReadFromParquet('ts.parquet', as_rows=True) | beam.Map(print)
# ValueError: Unrecognized arrow type: TimestampType(timestamp[us])
Cause: arrow_type_compatibility._beam_fieldtype_from_arrow_type only knows the primitive types, lists, maps and structs. _arrow_type_from_beam_fieldtype raises for every logical type.
Proposed fix, following Java's ArrowConversion, which reads ms/us timestamps as DATETIME:
- Arrow timestamp (any unit, with or without a time zone) maps to Beam
Timestamp(MicrosInstant). A timestamp with no time zone is taken as UTC. Nanosecond values are cast safely: whole microseconds convert, anything finer raises instead of being dropped silently. - Arrow
date32/date64maps to BeamDate(datetime.date). - For writing,
Timestamp(MicrosInstant/MillisInstant) maps totimestamp('us', tz='UTC')andDatetodate32.
Decimal, time and the other logical types are left as they are. Arrow decimals have a fixed precision and scale that Beam's Decimal doesn't carry, which is the same reason Java skips them.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
- Component: Python SDK
- Component: IO connector
- Langage dominant
- Java
- Étoiles
- 8.7k
- Forks
- 4.8k
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 445
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/beam
-
awaiting triage java new feature P2
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorPeut-être pris @shikhabhadoria l’a pris il y a 6 jours. Ouverteio P2 python
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
apache/beam#41346 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Release notes links wrongPeut-être pris @schizophrenicmaniac l’a pris il y a 20 jours. Ouvertebug P3
Difficulté 1/5 Moins d'une heure Accessibilité débutants 67/100
apache/beam#41197 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
apache/beam#39624 · 2 réactions ·
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizePeut-être pris @1fanwang l’a pris il y a 98 jours. Ouvertebug io P3 pinned pubsub
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/beam#28011 · 4 commentaires ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/beam
Issues similaires
-
effort/l priority/p1 risk/high triage/core
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
iflytek/skillhub#1188 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
testng-team/testng#3675 ·
Les mainteneurs répondent en général sous 1 jour
-
Improve readability of build file paths in the Run/Debug configuration "Build file" dropdownOuvertedesign
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
OpenLiberty/liberty-tools-intellij#1869 ·
Les mainteneurs répondent en général sous 1 jour
-
`ovsx verify` fails for a version older than the 100 newest of an extensionPeut-être pris @trivikr l’a pris aujourd’hui. Ouvertecli
Difficulté 2/5 1-3 heures Accessibilité débutants 81/100
eclipse-openvsx/openvsx#2482 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour