nanoarrow warns about precision loss for exactly representable int64 and timestamp values, failing two DBItest Arrow specs
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- R
- Star
- 345
- Fork
- 81
- Merge trung bình
- 8 giờ 21 phút
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không 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 r-dbi/RPostgres
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Dates and timestamps outside years 0001 to 9999, and `infinity`, are read as garbage, with a probable out-of-bounds readCó thể đã có người làm @krlmlr đã nhận hôm nay. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
performance
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của r-dbi/RPostgres
Issue tương tự
-
Installation fails from source: missing libintl.h on macOS, undeclared R_typeToChar() on R 4.6Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vincentarelbundock/xtx#11 ·
-
Check that backends override both `dbFetchArrowChunk()` and `dbClearArrowChunk()`, or neitherĐang mở
Độ 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 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
ichirio/rtfreporter#1166 ·
Maintainer thường phản hồi trong vòng 1 ngày