Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

a join on `period CONTAINS point` should bound the probe scan as the period form does

Aperta
#6,152 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
28/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
clojure, sql
Ambito
databases

Direzione di ricerca

Start with optimise-contains-period-predicate, the planner rule that rewrites contains? over two period constructors, and its TODO about the point form. Check temporal-contains-point? for the intended semantics, and how recall-with-cast2 casts timestamp-local and date points. Done means a point-form contains? in a join condition yields comparison bounds on the probe scan, with tests per point type (timestamp-tz, timestamp, date) across a DST overlap, such as the contains-precedence-bug-3473 test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

join-planning performance

A join on a period containing a point — b._valid_time CONTAINS a._valid_from — reaches the join as an opaque contains? call, so the probe scan gets no valid-time bound from it, where the period-against-period form does.

  • The planner rewrites CONTAINS to comparisons only when both arguments are period constructors.
    optimise-contains-period-predicate turns (contains? (period f1 t1) (period f2 t2)) into <=/>= over the ends, and leaves (contains? (period f t) x) alone; its own TODO anticipates the point form.

  • The join can only read a bound from comparisons.
    With the period form collapsed in join conditions, b._valid_time CONTAINS a._valid_time becomes b._valid_from <= a._valid_from and coalesce(b._valid_to, eot) >= coalesce(a._valid_to, eot), which bound the probe scan. The point form, the shape contains-precedence-bug-3473 uses, stays a contains? call and bounds nothing.

Potential approach

goal: (contains? (period f t) x) with x a point reaches the join as comparisons over f and t, so the probe scan takes the same bound as for the period form.

  • The point form rewrites to (and (<= f x) (< x (coalesce t xtdb/end-of-time))).
    That is temporal-contains-point?'s own definition (from <= ts < to), so the rewrite changes no result where the types agree.

  • check: the rewrite agrees with contains? for every point type contains? accepts.
    contains? casts a timestamp-local point to timestamp-tz in the default time zone, and a date to timestamp-local first (recall-with-cast2); <=/< against a timestamp-tz column cast the other way, to local time. Settle with a test per point type — timestamp-tz, timestamp, date — across a DST overlap, or restrict the rewrite to timestamp-tz points.

  • The point must be recognisably not a period.
    A bare column can be either (the existing test notes "not possible to tell if col1 is a period or a scalar temporal value"), so the rewrite needs the point's type.

    • assumption: the type is available at emit time and not in the logical plan.
      The join's emitter has its children's :vec-types, which is where the valid-time bound already reads the build expression's type; the planner's rules see only symbols. Settle by checking whether any rule in optimise-plan-rules has column types to hand.
Lingua principale
Clojure
Stelle
3.1k
Fork
193
Merge medio
23h 38m
PR unite (30g)
41

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di xtdb/xtdb

Tutte le issue di xtdb/xtdb

Issue simili

Altre issue su Clojure

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.