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

'tiledb_group_open()' should default to 'READ' #779

Open
cgiachalis opened this issue Oct 30, 2024 · 0 comments
Open

'tiledb_group_open()' should default to 'READ' #779

cgiachalis opened this issue Oct 30, 2024 · 0 comments
Assignees

Comments

@cgiachalis
Copy link
Contributor

cgiachalis commented Oct 30, 2024

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.

@johnkerl johnkerl self-assigned this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants