Skip to content

Phase 3: Advanced Query Features — OR, Navigation, Statistics (#141) - #158

Merged
nockawa merged 3 commits into
mainfrom
feature/141-advanced-query-features
Mar 11, 2026
Merged

nockawa merged 3 commits into
mainfrom
feature/141-advanced-query-features

Conversation

@nockawa

@nockawa nockawa commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Completes Phase 3 of the query system, adding three major capabilities:

  • OR Disjunction (L3) — || in predicates via DNF normalization (max 16 branches), per-entity branch bitmaps (Dictionary<long, ushort>), OrView<T> with incremental refresh (Phase 3 Sub 1: OR Disjunction (L3 Predicates) #142)
  • Navigation Joins (L4) — FK-based entity traversals (p.GuildId == g.Id), forward/reverse navigation with fan-out, NavigationView<TSource, TTarget> with source-first and target-first pipeline strategies (Phase 3 Sub 2: Navigation Joins (L4 Predicates) #143)
  • Advanced Statistics (HLL + MCV) — HyperLogLog (precision 12, 4KB/field) for approximate NDV, Most Common Values (top-100) for skew-aware selectivity, unified chunk-based rebuild via StatisticsRebuilder, StatisticsWorker background thread, AdvancedSelectivityEstimator replacing BasicSelectivityEstimator (Phase 3 Sub 3: Advanced Statistics (HLL + MCV) #144)

Additional improvements

  • Expression parser with full DNF support (De Morgan, operator flipping/inversion, double negation)
  • IEEE 754 order-preserving encoding fixes for float/double histogram bucketing
  • Hot-path optimizations: O(1) evaluator lookup tables (all view types), ProcessBatch split (set vs list), CollectionsMarshal for OrView bitmaps and secondary index iteration, Histogram helper inlining

Stats

  • 46 files changed, +6,035 / -219 lines
  • 2,154 tests passing, 0 failures

Test plan

  • All existing tests pass (no regression)
  • New test suites: OrViewTests, NavigationViewTests, ExpressionParserTests, HyperLogLogTests, MostCommonValuesTests, StatisticsRebuildTests, AdvancedEstimatorTests
  • Cross-zero float/double histogram tests
  • DNF branch limit enforcement (max 16)
  • Code coverage: Query area 82.0%, ExpressionParser 86.2%

Closes #141, #142, #143, #144

🤖 Generated with Claude Code

nockawa added 3 commits March 11, 2026 18:46
…timization (#144)

Add HyperLogLog, MostCommonValues, and StatisticsRebuilder for selectivity
estimation. Replace BasicSelectivityEstimator with AdvancedSelectivityEstimator
(MCV → Histogram → B+Tree → uniform chain). Add StatisticsWorker background
thread, mutation counter, and NavigationView/OrView query support.
@nockawa
nockawa merged commit 8e37d12 into main Mar 11, 2026
5 checks passed
@nockawa
nockawa deleted the feature/141-advanced-query-features branch March 11, 2026 23:50
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.

Phase 3: Advanced Query Features — OR Disjunction, Navigation Joins, Advanced Statistics

1 participant