Skip to content

Add Group support (for TileDB 2.8)#388

Merged
eddelbuettel merged 8 commits intomasterfrom
de/sc-16120/groups_api
Apr 1, 2022
Merged

Add Group support (for TileDB 2.8)#388
eddelbuettel merged 8 commits intomasterfrom
de/sc-16120/groups_api

Conversation

@eddelbuettel
Copy link
Copy Markdown
Contributor

@eddelbuettel eddelbuettel commented Mar 30, 2022

This PR adds support for Group objects as added in TileDB 2.8. The PR is (at least for now) labeled draft as we may want to refine a UI aspect or two, but should be feature complete with all member functions of the C++ class implemented at the C++ and R level, and tests added.

@shortcut-integration
Copy link
Copy Markdown

This pull request has been linked to Shortcut Story #16120: Add support for new Group API.

Comment thread R/Group.R Outdated
@eddelbuettel eddelbuettel force-pushed the de/sc-16120/groups_api branch from eafb136 to f5fa12b Compare March 31, 2022 16:31
Copy link
Copy Markdown
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

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

I'm still working my way through all of the new functionality but here a few minor comments so far.

Comment thread R/Group.R Outdated
Comment thread R/Group.R
Comment thread R/Group.R
Comment thread R/Group.R Outdated
Comment thread src/libtiledb.cpp
return R_NilValue;
}
RObject vec = _metadata_to_sexp(v_type, v_num, v);
vec.attr("key") = Rcpp::CharacterVector::create(key);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like storing the key name in an attribute. Will the array metadata getter adopt the same behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly. I like it better too.

We should talk about that because I need to refine what I do over there in terms of single values and vectors. This currently does not really support vectors. Would we ever want or need them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In terms of storing vectors as metadata ( tiledb_put_metadata(arr, "foo", c(1.1, 2.2, 3.3)))? Or retrieving metadata for multiple keys (tiledb_get_metadata(arr, key = c("foo", "vec")))?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The former. Whether it works cross-language, whether it works cross-language cross-type (i.e. int, double, string), ... I suggest we do this after we first achieve closure on this initial scope of work in this PR.

Multi-key is out of scope AFAICT.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@eddelbuettel / @aaronwolen we have a long standing need to add list datatypes in core. Which is most impactful for list of strings. We could implement this to nicely support this cross-platform.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense. But I think it's worth updating the array metadata getters to attach the same "key" attribute in this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suggest to back off and be a little more careful with that as it is technically a change to an existing interface. Feel free to open and issue / sc ticket and we see about making that change without impact, but I think it does not belong in this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

technically a change to an existing interface

Fair point.

It's a minor thing but my suggestion is either add the attribute in both places or neither. Unless there's a reason it makes sense for groups but not arrays?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I want to change it over at attributes too, I am simply suggesting to be careful about rather than rush it.

It's all an extra as the spec really is [key, value] and we do extract the value given the key.

@eddelbuettel eddelbuettel marked this pull request as ready for review April 1, 2022 13:37
Comment thread R/Group.R
##' @param recursive A logical value indicating whether a recursive dump is desired
##' @return A character string
##' @export
tiledb_group_member_dump <- function(grp, recursive) {
Copy link
Copy Markdown
Member

@aaronwolen aaronwolen Apr 1, 2022

Choose a reason for hiding this comment

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

If I create an empty group and then run tiledb_group_member_dump() the output includes the name of the group itself. Is that expected? e.g.,

library(tiledb)
uri <- tempfile()
chk <- tiledb_group_create(uri)
grp <- tiledb_group(uri, type = "READ")

tiledb_group_member_count(grp)
tiledb_group_member_dump(grp, recursive = FALSE)

produces

[1] 0
[1] "file71e162efd8c GROUP\n"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think so. I also noted that if we add a member, and then call dump we get INVALID as property.

I don;t have a comparison or spec and I basically act as middle man to the Core API here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe @Shelnutt2 can clarify? My assumption was the output would be empty when no group members are present.

Copy link
Copy Markdown
Member

@aaronwolen aaronwolen left a comment

Choose a reason for hiding this comment

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

Fundamentals look good. I still have a few questions but need to do a little more due diligence on my part.

@eddelbuettel eddelbuettel merged commit fce8f7b into master Apr 1, 2022
@eddelbuettel eddelbuettel deleted the de/sc-16120/groups_api branch April 1, 2022 21:11
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.

3 participants