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

Safer check for NAs in tiledb_config() #519

Merged
merged 3 commits into from
Feb 14, 2023
Merged

Conversation

mojaveazure
Copy link
Member

Replace if(is.na()) as R 4.2 errors when conditions > 1L Instead, removes NAs from config
Then, checks the length of config; if there is a length, adds it to the TileDB config

fixes #518

Replace `if(is.na())` as R 4.2 errors when conditions > 1L
Instead, removes NAs from `config`
Then, checks the length of `config`; if there is a length, adds it to
the TileDB config

fixes #518
@eddelbuettel
Copy link
Contributor

This looks good. It may be a function that predates me, and the use if NA here is a little non-standard (maybe check for missing() or empty string is cleaner) but changing it now and changing the interface is not great either.

Copy link
Contributor

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good especially with the added tests.

@mojaveazure
Copy link
Member Author

missing has it issues, so I tend to prefer having a default over using missing; Seurat uses NULL since rlang has %||% to check for it, but I think NA works well enough here. Plus, in the help page, the default is NA_character_ which indicates that config should be a character

@eddelbuettel
Copy link
Contributor

Let's table whether rlang is authorative for another day but I guess I meant to approve and comment and just commented. Correcting that now.

@eddelbuettel
Copy link
Contributor

The other reason that issue went undetected is that most uses of config use this pattern for one or more settings

cfg <- tiledb_config()
cfg["vfs.s3.region"] <- "us-west-1"
ctx <- tiledb_ctx(cfg)

and the more compact form of the named charecter vector which, as you correctly identified could be longer than length one, is not use much (but even more convenient).

@eddelbuettel
Copy link
Contributor

Oh, one more thing: can you add a line to NEWS.md with the PR number? I found adding [ci_skip] to the commit makes it a little lighter on non-code commits.

And then as it is approved feel free to squash-merge.

[ci_skip]
@mojaveazure mojaveazure merged commit 6abcd6e into master Feb 14, 2023
@mojaveazure mojaveazure deleted the ph/fix/is_na_config branch February 14, 2023 01:52
@@ -1,6 +1,7 @@
# tiledb 0.18.0.2 (Development)

* This release of the R package builds against [TileDB 2.14.1](https://github.com/TileDB-Inc/TileDB/releases/tag/2.14.1), and has also been tested against earlier releases as well as the development version (#502).
* Safer checking of `NAs` in `tiledb_config()` to support R 4.2 conditional lengths (#518, #519)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the file. Per precedent in this file (as well as what Core does) I tend to only list the PRs, not issues. We can address that in the next edition, no rush.

@eddelbuettel eddelbuettel mentioned this pull request Mar 13, 2023
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

Successfully merging this pull request may close these issues.

tiledb_config uses vectorized is.na in if
2 participants