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

[c++,python] Fix default reads on unwritten dense arrays #3136

Merged

Conversation

nguyenv
Copy link
Member

@nguyenv nguyenv commented Oct 4, 2024

Issue and/or context:

Found issue while working on spatial's MultiscaleImage and erroring out when applying read_spatial_region to a level that had not been written to yet.

Changes:

  • Add new non_empty_domain_slot_opt alongside non_empty_domain_slot that returns std::nullopt if it is empty rather than (0, 0)
  • Fix logic in C++ ManagedQuery::setup_read to check if the array has been written to yet. If it hasn't, set the subarray to use soma_dim_0's full domain. Otherwise, use the non-empty domain as before
  • Also fix logic in Python DenseNDArray.read to use the new non_empty_domain_slot_opt and correctly set the data_shape to the full domain if the array has not been written to yet
  • Add unit test in pytest

Copy link
Member

@johnkerl johnkerl left a comment

Choose a reason for hiding this comment

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

🔥

int32_t is_empty;
T ned[2];

// TODO currently we need to use the TileDB C API in order to check
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a tracking task with @teo-tsirpanis ? If not please open one! :)

libtiledbsoma/src/soma/soma_array.h Show resolved Hide resolved
* Found issue while working on spatial's `MultiscaleImage` and erroring
out when applying `read_spatial_region` to a level that had not been
written to yet
* Add new `non_empty_domain_slot_opt` alongside `non_empty_domain_slot`
that returns `std::nullopt` if it is empty rather than (0, 0)
* Fix logic in C++ `ManagedQuery::setup_read` to check if the array has
been written to yet. If it hasn't, set the subarray to use soma_dim_0's
full domain. Otherwise, use the non-empty domain as before
* Also fix logic in Python `DenseNDArray.read` to use the new
`non_empty_domain_slot_opt` and correctly set the `data_shape` to the
full domain if the array has not been written to yet
* Add unit test in pytest
@nguyenv nguyenv force-pushed the viviannguyen/fix-dense-array-default-on-unwritten-arrays branch from 600d1bb to bae0b64 Compare October 7, 2024 15:11
Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.54%. Comparing base (7018462) to head (4b92918).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3136      +/-   ##
==========================================
+ Coverage   82.41%   82.54%   +0.13%     
==========================================
  Files          50       50              
  Lines        5203     5209       +6     
==========================================
+ Hits         4288     4300      +12     
+ Misses        915      909       -6     
Flag Coverage Δ
python 82.54% <100.00%> (+0.13%) ⬆️

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

Components Coverage Δ
python_api 82.54% <100.00%> (+0.13%) ⬆️
libtiledbsoma ∅ <ø> (∅)

@nguyenv nguyenv merged commit 39e9ab3 into main Oct 7, 2024
15 checks passed
@nguyenv nguyenv deleted the viviannguyen/fix-dense-array-default-on-unwritten-arrays branch October 7, 2024 16:17
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