Skip to content

Datastore query binary search + SPDX/CI hygiene#104

Merged
facontidavide merged 2 commits into
mainfrom
chore/sustainability-review
May 29, 2026
Merged

Datastore query binary search + SPDX/CI hygiene#104
facontidavide merged 2 commits into
mainfrom
chore/sustainability-review

Conversation

@facontidavide
Copy link
Copy Markdown
Contributor

@facontidavide facontidavide commented May 29, 2026

Two independent, low-risk fixes surfaced during a code review, based directly on main.

1 · perf(datastore): binary-search RangeCursor start and latestAt

ARCHITECTURE.md documents both as binary searches, but findFirstValid() and latestAt() linear-scanned the chunk deque and the rows within a chunk (O(C·R)). Committed chunks are never empty and are time-ordered (each chunk's t_min >= the previous chunk's t_max), so t_min/t_max are monotonic across the deque and timestamps are monotonic within a chunk — enabling std::lower_bound/std::upper_bound for an O(log C + log R) start position.

Behaviour-preserving: lower_bound keeps the first-duplicate range start; upper_bound keeps the last-duplicate / later-chunk-at-shared-boundary semantics of the previous reverse scans. Adds regression tests for duplicate timestamps, shared chunk boundaries, and single-point ranges. Makes the ARCHITECTURE.md "binary-searches" claim accurate.

2 · chore: SPDX headers + drop stale development CI trigger

number_parse.{hpp,cpp} (pj_base, Apache-2.0) were missing their SPDX-License-Identifier headers — the dual-license boundary depends on per-file headers, so add them. All four branch-triggered workflows still keyed on the deleted development branch; restrict them to main.

Verification

  • Clean build under -Wall -Wextra -Werror + ASAN (./build.sh --debug).
  • 62/62 tests pass (./test.sh), incl. the new query edge tests and derived_engine_test/engine_integration_test, which exercise latestAt through the MIMO join.
  • All pre-commit hooks pass (clang-format v22 clean).

Release

PATCH-level — an internal behaviour-preserving optimization plus SPDX/CI hygiene. No API/ABI change.

🤖 Generated with Claude Code

facontidavide and others added 2 commits May 29, 2026 08:41
ARCHITECTURE.md documents both as binary searches, but findFirstValid()
and latestAt() linear-scanned the chunk deque and the rows within a chunk
(O(C*R)). Committed chunks are never empty and are time-ordered
(each chunk's t_min >= the previous chunk's t_max), so t_min/t_max are
monotonic across the deque and timestamps are monotonic within a chunk --
enabling std::lower_bound / std::upper_bound for an O(log C + log R) start.

Behaviour-preserving: lower_bound keeps the first-duplicate range start,
and upper_bound keeps the last-duplicate / later-chunk-at-shared-boundary
semantics of the previous reverse scans. Adds regression tests for
duplicate timestamps, shared chunk boundaries, and single-point ranges.
Makes the ARCHITECTURE.md "binary-searches" claim accurate. Internal
optimization; no API/ABI change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
number_parse.{hpp,cpp} (pj_base, Apache-2.0) lacked their
SPDX-License-Identifier headers -- the dual-license boundary relies on
per-file headers, so add them. All four branch-triggered workflows still
keyed on the deleted `development` branch; restrict them to `main`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@facontidavide facontidavide force-pushed the chore/sustainability-review branch from b0195e2 to 52127e1 Compare May 29, 2026 06:42
@facontidavide facontidavide changed the title Sustainability review backlog + query binary search + SPDX/CI hygiene Datastore query binary search + SPDX/CI hygiene May 29, 2026
@facontidavide facontidavide merged commit a8d117d into main May 29, 2026
4 checks passed
@facontidavide facontidavide deleted the chore/sustainability-review branch May 29, 2026 06:53
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