TileDB-R
TileDB-R copied to clipboard
'tiledb_group_open()' should default to 'READ'
tiledb_group_open() was meant to default to 'READ' without manual typing it. This happens because the match.arg(type) is placed after the version check with regards to type options, hence it errors about the length.
library(tiledb)
uri <- tempfile()
tiledb_group_create(uri)
grp <- tiledb_group(uri) # Defaults to READ
grp <- tiledb_group_close(grp)
tiledb_group_open(grp) # Should default to READ
#> Error in type != "MODIFY_EXCLUSIVE" || tiledb_version(TRUE) >= "2.12.0": 'length = 3' in coercion to 'logical(1)'
tiledb_group_open(grp, type = "READ")
#> filee887faf6ad3 GROUP
body(tiledb_group_open)
{
stopifnot(`The 'grp' argument must be a tiledb_group object` = is(grp,
"tiledb_group"), `This function needs TileDB 2.8.*` = .tiledb28(),
`Using 'MODIFY_EXCLUSIVE' needs TileDB 2.12.* or later` = type !=
"MODIFY_EXCLUSIVE" || tiledb_version(TRUE) >= "2.12.0")
type <- match.arg(type) # <==================== Nope!
grp@ptr <- libtiledb_group_open(grp@ptr, type)
grp
}
On the other hand tiledb_array_open() doesn't have this issue because does it differently; it performs the check inside the type argument, see below:
formals(tiledb_array_open)
$arr
$type
if (tiledb_version(TRUE) >= "2.12.0") c("READ", "WRITE", "DELETE",
"MODIFY_EXCLUSIVE") else c("READ", "WRITE")
Perhaps, tiledb_array_open() should list the type options as tiledb_group_open() and do the version check inside.