Skip to content

Hide events based on new tombstone rows#4

Closed
elffjs wants to merge 1 commit into
port_data_blobfrom
port_tombstone
Closed

Hide events based on new tombstone rows#4
elffjs wants to merge 1 commit into
port_data_blobfrom
port_tombstone

Conversation

@elffjs

@elffjs elffjs commented May 2, 2026

Copy link
Copy Markdown
Member

These events of type dimo.tombstone refer to files with the new voids_id column. By default, we hide voided files in the results.

Port of DIMO-Network/fetch-api#80.

These events of type dimo.tombstone refer to files with the new
voids_id column. By default, we hide voided files in the results.
zer0stars added a commit that referenced this pull request Jun 20, 2026
#3 events: dedup the decoded-event read path. lakeEventsDeduped collapses
at-rest duplicates (QUALIFY ROW_NUMBER over subject,timestamp,name,source —
ClickHouse's event ReplacingMergeTree key) so two cloud_event_ids that decode
to the same logical event count once, not twice. The materializer's INSERT
anti-join keeps them (its key includes cloud_event_id) and the signal read path
already deduped; the event read path did not, over-counting events vs CH.

#4 fetch: drop the 400-day lookback floor for subject-scoped fetches. It is a
DoS guard for subject-less, id-less scans only — ClickHouse imposes no floor
when given no `after`, and a subject prunes to one vehicle's files via the
(subject, time) sort, so latestCloudEvent / cloudEvents now reach arbitrarily
old events. A dormant vehicle whose newest event predates the window no longer
wrongly looks empty. The guard stays for genuinely unbounded searches.

#8 materializer: hard-error when MATERIALIZER_SHARD_COUNT>1 on the DuckLake
path. Sharding is not honored there (the global ingest_progress cursor allows
exactly one logical processor); refuse the config rather than silently run every
replica over the full stream and roll back the CAS losers.

#10 aggregations: implement inPolygon / inCircle location filters in pure SQL
(haversine great-circle distance; an even-odd ray cast unrolled over the
request's vertices) with no spatial-extension dependency, replacing the "not
supported on duckdb backend" rejection. Mirrors ClickHouse geoDistance /
pointInPolygon.
zer0stars added a commit that referenced this pull request Jun 23, 2026
Code-grounded, prioritized analysis of where the DuckLake query layer can exceed
the CH-parity implementation (CH limits: pre-materialized MVs, fetch-all-to-Go
detector loops, approximate functions). Covers: #0 ignition ongoing-trips (shipped),
#1 exact aggregations (shipped+pinned), #2 ASOF trip enrichment (location gap-fill
schema-free; distance/avg-speed via the existing Signals channel under no-schema),
#3 SQL-native idling/refuel/recharge, #4 spatial (needs LOAD spatial first), #5-7
secondary. Verified by the round-3 E2E reviews (spatial-not-loaded + the schema
caveats corrected).
@zer0stars

Copy link
Copy Markdown
Member

Closing as superseded — tombstone voiding is already on `main`, reimplemented natively in the DuckLake layer.

  • `voidingClause` (`internal/service/duck/lake_fetch.go`) excludes tombstone rows (`voids_id` set) and any event a same-subject tombstone voids (correlated anti-join on `voids_id == id`); `ExcludeVoided` is set on every fetch/index path; the materializer carries the `voids_id` column.

This PR targets the removed ClickHouse `eventrepo`, so rebasing would resurrect that stack. Functionality verified by #8: `TestLakeEventService_VoidingTombstoneBeforeEvent` (tombstone ingested before its target — order-independent) plus existing `TestLakeEventService_VoidingExcludes` (list / latest / summaries all exclude voided + tombstone).

Scope is identical to this PR: voiding hides raw CloudEvents (`cloudEvents`/`latestCloudEvent`); decoded `signals`/`events` are not voided (materializer keeps `_ = voidsID`). A separate propagation pass would be needed if VSS-level voiding is ever wanted.

@zer0stars zer0stars closed this Jun 25, 2026
zer0stars added a commit that referenced this pull request Jun 25, 2026
Lock in the two behaviors ported from the legacy ClickHouse eventrepo
(superseded PRs #3, #4), now served natively from the DuckLake layer:

- PresignBlobURL: a blob key becomes a presigned S3 GET URL for the
  configured blob bucket; nil presigner, empty bucket, and presigner
  failure all error loudly rather than panic or silently inline.
  Complements TestLakeEventService_BlobIndexKey (blob-key routing into
  the resolver's HasPrefix(key, BlobKeyPrefix) presign branch).
- Voiding under reverse ingest order: a tombstone whose timestamp
  precedes the event it voids still hides that event (the anti-join keys
  on voids_id == id, not on time). Complements
  TestLakeEventService_VoidingExcludes (tombstone-after).
@zer0stars zer0stars deleted the port_tombstone branch June 25, 2026 19:48
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