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++] Fix fast path for SparseNDArray nnz #3229

Merged
merged 1 commit into from
Oct 24, 2024
Merged

Conversation

johnkerl
Copy link
Member

Issue and/or context: [sc-58277]

Changes:

Notes for Reviewer:

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.97%. Comparing base (29b2648) to head (6eaba1e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3229      +/-   ##
==========================================
+ Coverage   83.86%   83.97%   +0.10%     
==========================================
  Files          51       51              
  Lines        5505     5505              
==========================================
+ Hits         4617     4623       +6     
+ Misses        888      882       -6     
Flag Coverage Δ
python 83.97% <ø> (+0.10%) ⬆️

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

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

Copy link
Member

@bkmartinjr bkmartinjr left a comment

Choose a reason for hiding this comment

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

I understand why this change "fixes" the problem, but I'm uncomfortable with the design (in both the original PR and in this fix). It relies on a heuristic (names), and disallows lots of cases where the fast path would work fine (e.g., other non-variable-sized dimensions)

Possible solutions to consider:

  1. directly test the dimension to determine if it variable-sized. Only then fall back (ie.., don't test name or hard-wire to only int64)
  2. Or, given that the most common case, simply wrap the nonempty-domain fetch in a try/catch, and call the slow path only when you can't get it.

Either of these seem far less likely to bite us in the future as they are not heuristics based

@johnkerl
Copy link
Member Author

johnkerl commented Oct 24, 2024

@bkmartinjr #3231 if you're willing to take this as a follow-on

and disallows lots of cases where the fast path would work fine

You're correct

I do want to do that as separate PRs -- this one and the to-be-created tracked on #3231 -- precisely because this PR "gets it right" for the most important cases which are (a) default-indexed dataframes; (b) all ND arrays always (which must have int64 dims). So the follow-on PR will enable us to take the fast path for non-default-indexed dataframes, and that will be nice.

@johnkerl johnkerl merged commit 99ba3a3 into main Oct 24, 2024
15 checks passed
@johnkerl johnkerl deleted the kerl/snda-fast-nnz branch October 24, 2024 03:01
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