Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#51,695 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
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.
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.3k
平均マージ
4日 12時間
マージ済み PR(30日)
102

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/arrow のほかの issue

apache/arrow の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。