You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2023/11/30 20:49:18 UTC
[PR] feat: Reference count child objects [arrow-adbc]
paleolimbot opened a new pull request, #1334:
URL: https://github.com/apache/arrow-adbc/pull/1334
Closes https://github.com/apache/arrow-nanoarrow/issues/323 , https://github.com/apache/arrow-adbc/issues/1128 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(r): Reference count child objects [arrow-adbc]
Posted by "krlmlr (via GitHub)" <gi...@apache.org>.
krlmlr commented on code in PR #1334:
URL: https://github.com/apache/arrow-adbc/pull/1334#discussion_r1434188732
##########
r/adbcdrivermanager/R/helpers.R:
##########
@@ -244,53 +239,69 @@ local_adbc <- function(x, .local_envir = parent.frame()) {
#'
adbc_connection_join <- function(connection, database) {
assert_adbc(connection, "adbc_connection")
- assert_adbc(database, "adbc_database")
+
+ stopifnot(
+ identical(database, connection$database),
+ identical(database$.child_count, 1L)
+ )
connection$.release_database <- TRUE
- connection$database <- adbc_xptr_move(database)
+ connection$database <- adbc_xptr_move(database, check_child_count = FALSE)
+ xptr_set_protected(connection, connection$database)
invisible(connection)
}
#' @rdname adbc_connection_join
#' @export
adbc_statement_join <- function(statement, connection) {
assert_adbc(statement, "adbc_statement")
- assert_adbc(connection, "adbc_connection")
+
+ stopifnot(
+ identical(connection, statement$connection),
+ identical(connection$.child_count, 1L)
+ )
statement$.release_connection <- TRUE
- statement$connection <- adbc_xptr_move(connection)
+ statement$connection <- adbc_xptr_move(connection, check_child_count = FALSE)
+ xptr_set_protected(statement, statement$connection)
invisible(statement)
}
-#' @rdname adbc_connection_join
-#' @export
-adbc_stream_join <- function(stream, x) {
- if (utils::packageVersion("nanoarrow") < "0.1.0.9000") {
- stop("adbc_stream_join_statement() requires nanoarrow >= 0.2.0")
- }
-
- assert_adbc(stream, "nanoarrow_array_stream")
- assert_adbc(x)
+adbc_child_stream <- function(parent, stream, release_parent = FALSE) {
+ assert_adbc(parent)
+ # This finalizer will run immediately on release (if released explicitly
+ # on the main R thread) or on garbage collection otherwise.
self_contained_finalizer <- function() {
- try(adbc_release_non_null(x))
+ try({
+ parent$.child_count <- parent$.child_count - 1L
Review Comment:
Should this and other code be using `adbc_update_parent_child_count()` or a variant under the hood?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(r): Reference count child objects [arrow-adbc]
Posted by "krlmlr (via GitHub)" <gi...@apache.org>.
krlmlr commented on code in PR #1334:
URL: https://github.com/apache/arrow-adbc/pull/1334#discussion_r1434191004
##########
r/adbcdrivermanager/src/radbc.h:
##########
@@ -22,6 +22,8 @@
#include <utility>
+#include <adbc.h>
Review Comment:
If this include is added here, should we remove it from some source files?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(r): Reference count child objects [arrow-adbc]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #1334:
URL: https://github.com/apache/arrow-adbc/pull/1334
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org