Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIGINT-to-integer overflow warning doesn't mention the column name #198

Open
jarodmeng opened this issue Sep 29, 2022 · 1 comment
Open
Assignees

Comments

@jarodmeng
Copy link
Contributor

Currently when a BIGINT column is coerced into integer in R, RPresto churns out a generic warning message

library(RPresto)
library(DBI)

conn <- RPresto::presto_default()
dbGetQuery(conn, "SELECT CAST(POW(2, 31) AS BIGINT) AS bigint_overflow")
#> Warning in as.integer.integer64(x): NAs produced by integer overflow
#> # A tibble: 1 × 1
#>   bigint_overflow
#>             <int>
#> 1              NA

Created on 2022-09-29 with reprex v2.0.2

This warning message is produced by bit64::as.integer.integer64().

In a dummy example like the one above, it's trivial to figure out which column causes the overflow. But in a table with significantly more columns, it could be difficult to figure out which one is the culprit and needs attention. We should give the overflow warning with the offending column name, so it's easier for the user to troubleshoot and deal with the warning.

@jarodmeng jarodmeng self-assigned this Sep 29, 2022
@jarodmeng
Copy link
Contributor Author

The solution should work not only for top-level columns, but also for sub-fields in complex types (i.e. ARRAY, ROW, and MAP).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant