-
Notifications
You must be signed in to change notification settings - Fork 18
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
Preserve integer64 class #309
Conversation
Current Aviator status
This PR was closed without merging. If you still want to merge this PR, re-open it.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
Thanks. The RSQLite reprex now gives different results, still with failures. I assume this is because RSQLite doesn't return int64 logicals. Do you have an example of an actual driver where this change gives better results? I'd also like to limit the impact of this change to where it matters. Can we perhaps change the definition of the ctx <- DBItest::make_context(
RSQLite::SQLite(),
list(
dbname = tempfile("DBItest", fileext = ".sqlite"),
bigint = "integer64"
),
tweaks = DBItest::tweaks(
logical_return = function(x) lapply(x, bit64::as.integer64)
)
)
DBItest::test_some("data_logical", ctx, FALSE)
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 1L] not identical to structure(4.94065645841247e-324, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "none") at DBItest/R/spec-result-roundtrip.R:262:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 1L], `<int64>`)
#>
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 2L] not identical to structure(0, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "none") at DBItest/R/spec-result-roundtrip.R:262:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 2L], `<int64>`)
#>
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 1L] not identical to structure(4.94065645841247e-324, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "above") at DBItest/R/spec-result-roundtrip.R:263:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 1L], `<int64>`)
#>
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 2L] not identical to structure(0, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "above") at DBItest/R/spec-result-roundtrip.R:263:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 2L], `<int64>`)
#>
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 1L] not identical to structure(4.94065645841247e-324, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "below") at DBItest/R/spec-result-roundtrip.R:264:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 1L], `<int64>`)
#>
#> ── Failure: DBItest: Result: data_logical ──────────────────────────────────────
#> rows[1L, 2L] not identical to structure(0, class = "integer64").
#> Classes differ: 'integer' is not 'integer64'
#> Backtrace:
#> ▆
#> 1. ├─rlang::exec(test_fun, !!!args) at DBItest/R/run.R:77:11
#> 2. └─DBItest (local) `<fn>`(ctx = `<DBItst_c>`, con = `<SQLtCnnc>`)
#> 3. ├─testthat::expect_warning(...) at DBItest/R/spec-result-roundtrip.R:29:5
#> 4. │ └─testthat:::quasi_capture(...)
#> 5. │ ├─testthat (local) .capture(...)
#> 6. │ │ └─base::withCallingHandlers(...)
#> 7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
#> 8. └─DBItest:::test_select_with_null(...)
#> 9. └─DBItest:::test_select(..., .add_null = "below") at DBItest/R/spec-result-roundtrip.R:264:3
#> 10. ├─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun)))) at DBItest/R/spec-result-roundtrip.R:328:7
#> 11. │ └─base::eval(bquote(expect_identical(rows[1L, .(i)], .(value_or_testfun))))
#> 12. └─testthat::expect_identical(rows[1L, 2L], `<int64>`)
#> Error:
#> ! Test failed
#> Backtrace:
#> ▆
#> 1. └─DBItest::test_some("data_logical", ctx, FALSE)
#> 2. └─DBItest::test_all(run_only = test, skip = character(), ctx = ctx) at DBItest/R/test-all.R:56:3
#> 3. └─DBItest::test_result(skip = skip, run_only = run_only, ctx = ctx) at DBItest/R/test-all.R:29:3
#> 4. └─DBItest:::run_tests(ctx, spec_result, skip, run_only, test_suite) at DBItest/R/test-result.R:17:3
#> 5. └─base::vapply(...) at DBItest/R/run.R:32:3
#> 6. └─DBItest (local) FUN(X[[i]], ...)
#> 7. └─testthat::test_that(...) at DBItest/R/run.R:42:9
#> 8. └─withr (local) `<fn>`(`<env>`) at DBItest/R/run.R:42:9
#> 9. ├─base::tryCatch(...)
#> 10. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 11. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 12. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 13. └─base::eval(handler$expr, handler$envir)
#> 14. └─base::eval(handler$expr, handler$envir)
#> 15. └─reporter$stop_if_needed()
#> 16. └─rlang::abort("Test failed", call = NULL) Created on 2023-11-26 with reprex v2.0.2 |
2d6e098
to
3d778fe
Compare
954fb7d
to
e6d92c1
Compare
e6d92c1
to
260ff77
Compare
Solved differently, I think. |
Something like this solves my problem. Whether it's a smart move to fix something that's essentially an upstream issue in such a way is an open question to me. Happy to discuss @krlmlr.
Fixes #308.