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

[r] Metadata read/write support via libtiledbsoma #2819

Merged
merged 8 commits into from
Aug 7, 2024

Conversation

eddelbuettel
Copy link
Contributor

@eddelbuettel eddelbuettel commented Jul 29, 2024

Issue and/or context:

This PR adds support for metadata reading and writing via libtiledbsoma. It does not yet add support for timestamp'ed create / write / read which will follow in subsequent PR building on this.

Changes:

The write-path for object creation and write is now fully utilizing the libtiledbsoma facilities (though the additional timestamp feature is yet to come, work in progress).

Notes for Reviewer:

SC 51949

#2698

@eddelbuettel eddelbuettel force-pushed the de/sc-51949/metadata branch 5 times, most recently from a766df7 to 8ef872e Compare August 1, 2024 13:50
Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (edabcb6) to head (61dc560).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2819      +/-   ##
==========================================
+ Coverage   90.06%   90.16%   +0.10%     
==========================================
  Files          37       37              
  Lines        3945     3957      +12     
==========================================
+ Hits         3553     3568      +15     
+ Misses        392      389       -3     
Flag Coverage Δ
python 90.16% <ø> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 90.16% <ø> (+0.10%) ⬆️
libtiledbsoma ∅ <ø> (∅)

@eddelbuettel eddelbuettel force-pushed the de/sc-51949/metadata branch 4 times, most recently from 8a00177 to fa733f7 Compare August 5, 2024 22:15
@eddelbuettel eddelbuettel marked this pull request as ready for review August 6, 2024 12:05
@eddelbuettel eddelbuettel changed the title [r] Metadata read/write support via libtiledbsoma [WIP] [r] Metadata read/write support via libtiledbsoma Aug 7, 2024
apis/r/src/arrow.cpp Show resolved Hide resolved
libtiledbsoma/src/soma/soma_array.h Show resolved Hide resolved
@nguyenv
Copy link
Member

nguyenv commented Aug 7, 2024

Why are the metadata accessors implemented as static methods? You should be able to use SOMAArray::open to open the array and then use the member functions SOMAArray::get_metadata, etc. (and same for SOMAGroup).

@eddelbuettel
Copy link
Contributor Author

eddelbuettel commented Aug 7, 2024

Can you point to line and file? In src/metadata.cpp I use a (common) helper to return the unique pointer, and utilise that across a half-dozen functions i.e. this to access the bool check for existence

std::unique_ptr<tdbs::SOMAObject> getObjectUniquePointer(bool is_array, OpenMode mode,
                                                         std::string& uri,
                                                         std::shared_ptr<tdbs::SOMAContext> ctx) {
    if (is_array) {
        return tdbs::SOMAArray::open(mode, uri, ctx);
    } else {
        return tdbs::SOMAGroup::open(mode, uri, ctx);
    }
}

// .... more lines omitted ...

// [[Rcpp::export]]
bool has_metadata(std::string& uri, std::string& key, bool is_array,
                  Rcpp::XPtr<somactx_wrap_t> ctxxp) {
    // shared pointer to SOMAContext from external pointer wrapper
    std::shared_ptr<tdbs::SOMAContext> sctx = ctxxp->ctxptr;
    // SOMA Object unique pointer (aka soup)
    auto soup = getObjectUniquePointer(is_array, OpenMode::read, uri, sctx);
    return soup->has_metadata(key);
}

I don't think I add static methods. Am I overlooking something?

@eddelbuettel eddelbuettel merged commit 274c6f4 into main Aug 7, 2024
14 of 15 checks passed
@eddelbuettel eddelbuettel deleted the de/sc-51949/metadata branch August 7, 2024 15:45
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.

2 participants