8000 perf(query): implement index-guided lookups (issue #30) by adityamukho · Pull Request #84 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf(query): implement index-guided lookups (issue #30) - #84

Merged
adityamukho merged 1 commit into
mainfrom
fix/issue-30-index-guided-lookups
Apr 3, 2026
Merged

adityamukho merged 1 commit into
mainfrom
fix/issue-30-index-guided-lookups

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

  • Add lookup methods to Indexes: lookup_eavt_entity, lookup_aevt_attr, lookup_avet_attr_value, lookup_vaet_ref
  • Add match_patterns_with_hints to PatternMatcher that uses index hints
  • Add lookup_with_hint to use appropriate index based on IndexHint
  • Update executor to pass (Pattern, IndexHint) pairs to matcher

The matcher now uses index lookups when hints are available, falling back to full scan when index lookup is not applicable (e.g., variable bindings).

Note: This is Phase 6.2 implementation. The current index lookup returns all matching fact refs, but we still scan all facts in memory. Future work could use the fact refs to directly access packed pages.

Issue: PatternMatcher ignores indexes, always does full scan

Changes:
- Add lookup methods to Indexes: lookup_eavt_entity, lookup_eavt_entity_attr,
  lookup_aevt_attr, lookup_avet_attr_value, lookup_vaet_ref
- Add match_patterns_with_hints to PatternMatcher that uses index hints
- Add lookup_with_hint to use appropriate index based on IndexHint
- Update executor to pass (Pattern, IndexHint) pairs instead of just patterns

The matcher now uses index lookups when hints are available, falling back to
full scan when index lookup is not applicable (e.g., variable bindings).
@codecov
codecov Bot commented Apr 3, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.59%. Comparing base (59e634c) to head (a732fa3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/query/datalog/matcher.rs 67.39% 15 Missing ⚠️
src/storage/index.rs 64.28% 10 Missing ⚠️

❌ Your patch status has failed because the patch coverage (66.66%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (59e634c) and HEAD (a732fa3). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (59e634c) HEAD (a732fa3)
branch-coverage 1 0
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
- Coverage   91.72%   84.59%   -7.14%     
==========================================
  Files          25       25              
  Lines       14494     4549    -9945     
  Branches      525        0     -525     
==========================================
- Hits        13295     3848    -9447     
+ Misses       1140      701     -439     
+ Partials       59        0      -59     
Flag Coverage Δ
branch-coverage ?

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

Files with missing lines Coverage Δ
src/query/datalog/executor.rs 94.46% <100.00%> (-2.60%) ⬇️
src/storage/index.rs 89.79% <64.28%> (-10.21%) ⬇️
src/query/datalog/matcher.rs 85.41% <67.39%> (-10.75%) ⬇️

... and 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

8000
@adityamukho
adityamukho merged commit 3f67c8f into main Apr 3, 2026
14 of 15 checks passed
@adityamukho
adityamukho deleted the fix/issue-30-index-guided-lookups branch April 3, 2026 05:12
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.

1 participant

0