Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭 适合新手
#51,695 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@james-finn-travers 已经在做这个了。

开始于 2026年10月3日。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
r

调研方向

从 write_parquet() 和 read_parquet() 使用的 R 元数据序列化入手,重点关注建议修复中的 serialize() 调用。确认 double 值属性(包括日期时间)能够通过 write_parquet()/read_parquet() 完全往返,同时现有文件仍然可读,且不需要修改 reader。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
C++
星标
17.2k
派生
4.4k
平均合并
3 天 8 小时
30 天内合并 PR
69

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow 的其他 Issue

查看 apache/arrow 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。