nanoarrow warns about precision loss for exactly representable int64 and timestamp values, failing two DBItest Arrow specs
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
The reported warning originates in nanoarrow's r/src/materialize_dbl.h; timestamps also pass through r/src/materialize_posixct.h. Start by checking the linked upstream fix for timestamps and whether the exact int64 case is covered. Reproduce both cases, then verify that only inexact conversions warn and that the two *_timestamp_extended DBItest specs pass before considering the RPostgres skips.
索引モデルが issue の本文から書いたものです。
説明
nanoarrow warns "may have incurred loss of precision in conversion to double()" for every int64 value above 2^53 in magnitude, even when the double is exact. Timestamps are stored as int64 microseconds, so every timestamp after 2255-06-05 warns too. This is the only cause of the two failing DBItest specs arrow_write_table_arrow_roundtrip_timestamp_extended and arrow_append_table_arrow_roundtrip_timestamp_extended (value 2999-09-09): the data round-trips correctly, but the specs expect no warnings, and they get one per conversion on the write side (as.data.frame() in DBI's dbAppendTableArrow()) and on the read side (DBItest's check_arrow()).
Location: nanoarrow, materialize_dbl.h counts every int64 outside ±2^53 as lossy and warns; timestamps go through the same code via materialize_posixct.h. The timestamp case is reported upstream as apache/arrow-nanoarrow#1031, which GitHub shows as closed by apache/arrow-nanoarrow#1034 (merged 2026-11-26, after nanoarrow 0.9.0); not verified here against nanoarrow's main branch. The plain int64 case (first part of the reprex) is not covered by that report.
Reprex against the CRAN releases:
# 2^53 + 2 is exactly representable as a double
a <- nanoarrow::as_nanoarrow_array(bit64::as.integer64("9007199254740994"))
x <- as.vector(a)
#> Warning in convert_array.default(x, to = infer_nanoarrow_ptype(x)): 1 value(s)
#> may have incurred loss of precision in conversion to double()
sprintf("%.0f", x)
#> [1] "9007199254740994"
# Expected: no warning, since the value is exact
# Same for a microsecond timestamp after 2255-06-05, as used by DBItest's timestamp_extended specs
df <- as.data.frame(nanoarrow::as_nanoarrow_array(data.frame(t = as.POSIXct("2999-09-09", tz = "UTC"))))
#> Warning in
#> as.data.frame.nanoarrow_array(nanoarrow::as_nanoarrow_array(data.frame(t =
#> as.POSIXct("2999-09-09", : 1 value(s) may have incurred loss of precision in
#> conversion to double()
df$t
#> [1] "2999-09-09 UTC"
# Expected: no warning
as.data.frame(sessioninfo::package_info(c("nanoarrow", "DBItest"), dependencies = FALSE))[c("package", "ondiskversion", "source")]
#> package ondiskversion source
#> DBItest DBItest 1.9.0 RSPM
#> nanoarrow nanoarrow 0.9.0 RSPM
Created on 2026-11-29 with reprex v2.1.1
- report upstream, timestamp case (apache/arrow-nanoarrow#1031)
- report upstream, exact int64 values
- check the two
*_timestamp_extendedspecs again with the next nanoarrow release, and stop skipping them in RPostgres's DBItest setup once they pass
Severity: low (proposed, Kirill may change). The values are correct; only the warning is spurious.
Native Arrow support is coordinated in https://github.com/r-dbi/RPostgres/pull/631; it is not expected to fix this by construction. It removes the write-side warning, but DBItest's read-side check still converts with nanoarrow, so the specs keep failing until nanoarrow warns only for inexact values (or DBItest muffles the warning).
- 主要言語
- R
- スター
- 345
- フォーク
- 81
- 平均マージ
- 8時間 21分
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
r-dbi/RPostgres のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
Dates and timestamps outside years 0001 to 9999, and `infinity`, are read as garbage, with a probable out-of-bounds read対応中かも @krlmlr が今日担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
performance
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
r-dbi/RPostgres の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vincentarelbundock/xtx#11 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
priority:low
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
ichirio/rtfreporter#1166 ·
メンテナーはふだん 1 日以内に返信