nanoarrow warns about precision loss for exactly representable int64 and timestamp values, failing two DBItest Arrow specs
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- R
- Estrellas
- 345
- Forks
- 81
- Merge medio
- 8 h 21 min
- PR fusionados (30 d)
- 18
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de r-dbi/RPostgres
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dates and timestamps outside years 0001 to 9999, and `infinity`, are read as garbage, with a probable out-of-bounds readPosiblemente ocupada @krlmlr la tomó hoy. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
performance
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de r-dbi/RPostgres
Issues similares
-
Installation fails from source: missing libintl.h on macOS, undeclared R_typeToChar() on R 4.6Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vincentarelbundock/xtx#11 ·
-
Check that backends override both `dbFetchArrowChunk()` and `dbClearArrowChunk()`, or neitherAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
priority:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
ichirio/rtfreporter#1166 ·
Los mantenedores suelen responder en 1 día