Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[R] Silent loss of metadata integrity for date-time and numeric attributes in write_parquet()/read_parquet()

Đang mở Phù hợp với người mới
#51,695 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
r
Lĩnh vực
data-engineering

Hướng nghiên cứu

Bắt đầu từ việc tuần tự hóa siêu dữ liệu R được write_parquet() và read_parquet() sử dụng, tập trung vào lệnh gọi serialize() trong bản sửa được đề xuất. Xác nhận rằng các thuộc tính có giá trị double, bao gồm cả ngày-giờ, được round-trip chính xác qua write_parquet()/read_parquet(), đồng thời các tệp hiện có vẫn có thể đọc được và không cần thay đổi reader.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Component: R Type: bug
Describe the bug, including details regarding any error messages, version, and platform.

Double-valued attributes, including date-times, do not round-trip through Arrow's R metadata. No warning is raised. (Tested on arrow 25.0.1, R 4.6.1, Linux.)

library(arrow)
options(digits.secs = 6)

df <- data.frame(x = 1:3)
attr(df, "updated") <- as.POSIXct("2026-10-02 14:30:15.987654321", tz = "UTC")

f <- tempfile(fileext = ".parquet")
write_parquet(df, f)
back <- read_parquet(f)

attr(df, "updated")
#> [1] "2026-10-02 14:30:15.987654 UTC"
attr(back, "updated")
#> [1] "2026-10-02 14:30:15.987653 UTC"
identical(attr(back, "updated"), attr(df, "updated"))
#> [1] FALSE
Suggested fix

Fortuitously, R already has an exact variant of the ASCII format, so the fix is simple and fully backwards compatible.

Arrow uses R_pstream_ascii_format (ascii = TRUE in base::serialize). Instead use R_pstream_asciihex_format (ascii = NA).

out <- serialize(safe_r_metadata(x, on_save = TRUE), NULL, ascii = NA)

The hex format means that doubles are written out in hex instead of decimal.

Either way, the output still starts with "A" (arrow's check) and base unserialize() reads it fine, so the reader needs no change and previous versions work with the output.

Component(s)

R

Ngôn ngữ chính
C++
Star
17.2k
Fork
4.3k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
93

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/arrow

Tất cả issue của apache/arrow

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.