[Bug]: [Python] ReadFromParquet(as_rows=True) fails on timestamp and date columns ("Unrecognized arrow type")
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- Java
- Star
- 8.7k
- Fork
- 4.8k
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 445
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/beam
-
awaiting triage java new feature P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorCó thể đã có người làm @shikhabhadoria đã nhận 6 ngày trước. Đang mởio P2 python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/beam#41346 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Release notes links wrongCó thể đã có người làm @schizophrenicmaniac đã nhận 20 ngày trước. Đang mởbug P3
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
apache/beam#41197 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/beam#39624 · 2 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizeCó thể đã có người làm @1fanwang đã nhận 98 ngày trước. Đang mởbug io P3 pinned pubsub
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/beam#28011 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
effort/l priority/p1 risk/high triage/core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
iflytek/skillhub#1188 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
testng-team/testng#3675 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Improve readability of build file paths in the Run/Debug configuration "Build file" dropdownĐang mởdesign
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
OpenLiberty/liberty-tools-intellij#1869 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`ovsx verify` fails for a version older than the 100 newest of an extensionCó thể đã có người làm @trivikr đã nhận hôm nay. Đang mởcli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
eclipse-openvsx/openvsx#2482 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày