Skip to content

[c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases#3069

Merged
johnkerl merged 10 commits intomainfrom
kerl/cpp-sdf-domain-at-create
Sep 27, 2024
Merged

[c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases#3069
johnkerl merged 10 commits intomainfrom
kerl/cpp-sdf-domain-at-create

Conversation

@johnkerl
Copy link
Copy Markdown
Contributor

@johnkerl johnkerl commented Sep 25, 2024

Issue and/or context: As tracked on issue #2407 / [sc-51048].

Note that the intended Python and R API changes are all agreed on and finalized as described in #2407.

Changes:

While working on R-level #3032 I realized to my unpleasant surprise that I'd neither tested nor implemented custom domain-setting for SOMADataFrame at the C++ level. This PR fixes that oversight.

Along the way I split out a necessary helper function in ArrowAdapter, and changed some method names to make them clearer. I'm happy to do this as split-out commits or split-out PRs if that makes it easier to review.

Notes for Reviewer:

@johnkerl johnkerl changed the title [c++] Expose custom domain for libtiledbsoma unit-test cases [c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases Sep 25, 2024
@johnkerl johnkerl changed the title [c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases [c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases [WIP] Sep 25, 2024
@johnkerl johnkerl marked this pull request as draft September 25, 2024 22:17
@johnkerl johnkerl force-pushed the kerl/cpp-sdf-domain-at-create branch 3 times, most recently from 9574fe7 to e614221 Compare September 25, 2024 23:50
@johnkerl johnkerl requested review from jp-dark and nguyenv September 25, 2024 23:50
@johnkerl johnkerl marked this pull request as ready for review September 25, 2024 23:51
@johnkerl johnkerl changed the title [c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases [WIP] [c++] Expose custom DataFrame domain for libtiledbsoma unit-test cases Sep 26, 2024
@johnkerl johnkerl force-pushed the kerl/cpp-sdf-domain-at-create branch from e614221 to bcc51f3 Compare September 26, 2024 03:10
@johnkerl johnkerl force-pushed the kerl/cpp-sdf-domain-at-create branch from 235e699 to 74c7f15 Compare September 26, 2024 13:32
@johnkerl johnkerl force-pushed the kerl/cpp-sdf-domain-at-create branch from 74c7f15 to be66574 Compare September 27, 2024 00:39
arrow_table, column_index, 2);

return get_array_non_string_column<T>(child_array);
}
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.

Could overload get_table_non_string_column but also fine as is.

template <typename T>
static std::vector<T> get_table_non_string_column(
    const ArrowTable& arrow_table, const std::string& column_name);

template <typename T>
static std::vector<T> get_table_non_string_column(
    const ArrowTable& arrow_table, int64_t column_index);

Copy link
Copy Markdown
Contributor Author

@johnkerl johnkerl Sep 27, 2024

Choose a reason for hiding this comment

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

Could overload get_table_non_string_column but also fine as is.

I should leave a comment

Originally I used template specialization

template <typename T>
foo(T a, T b) ...

template <>
foo(std::string a, std::string b) ...

and I kept getting spots where the non-string version was getting called even in string contexts

I tried to be clever & I persisted, but, ultimately I decided it wasn't worth it. I've been doing C/C++ a long time, I'm no slouch, and if it was fragile for me, it's not worth leaving in a fragile state.

So I went with the _string suffix, and the

if (std::is_same_v<T, std::string>) {
    throw std::runtime_error(...)
}

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.

Base automatically changed from kerl/ut-generate to main September 27, 2024 01:49
@johnkerl johnkerl force-pushed the kerl/cpp-sdf-domain-at-create branch from be66574 to a40f130 Compare September 27, 2024 01:55
…l-data/TileDB-SOMA into kerl/cpp-sdf-domain-at-create
@johnkerl johnkerl merged commit 815b4ab into main Sep 27, 2024
@johnkerl johnkerl deleted the kerl/cpp-sdf-domain-at-create branch September 27, 2024 02:03
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.94%. Comparing base (1d35e0b) to head (81a006d).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3069      +/-   ##
==========================================
+ Coverage   89.79%   89.94%   +0.14%     
==========================================
  Files          41       41              
  Lines        4107     4107              
==========================================
+ Hits         3688     3694       +6     
+ Misses        419      413       -6     
Flag Coverage Δ
python 89.94% <ø> (+0.14%) ⬆️

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

Components Coverage Δ
python_api 89.94% <ø> (+0.14%) ⬆️
libtiledbsoma ∅ <ø> (∅)

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