A window kept as a window over an all-regular input #
A pass that re-types every node to regular columns meets a window over
an input holding aggregate columns. The window reads the regular columns
of each row and nothing of the aggregate ones (ColKind.readTuple), its
partition, its order, its term, its clause and the tie-break of its peers
all seeing the nulled row; so the window over the re-typed input, which
reads every column, is a different query – two peers that agree on their
regular columns are ordered by their aggregate values there, which an
order-dependent aggregate reads. The window is kept by doubling the
input instead: each row is prefixed by its nulled copy, the window is
written over the first block, and the first block is projected away
afterwards. Peers that agree on the nulled row are then listed in an
order the window cannot tell apart, the values it reads being read off
the first block, and AggQueryIn.evaluatePlain_winKept is the equality.
A term over a longer row, reading its first block #
A term widened to a row with n' more columns on the right.
Equations
- TermIn.widen n' (TermIn.const a) = TermIn.const a
- TermIn.widen n' (TermIn.outer j) = TermIn.outer j
- TermIn.widen n' #i = #(Fin.castAdd n' i)
- TermIn.widen n' (t₁.add t₂) = (TermIn.widen n' t₁).add (TermIn.widen n' t₂)
- TermIn.widen n' (t₁.sub t₂) = (TermIn.widen n' t₁).sub (TermIn.widen n' t₂)
- TermIn.widen n' (t₁.mul t₂) = (TermIn.widen n' t₁).mul (TermIn.widen n' t₂)
- TermIn.widen n' (TermIn.caseWhen op t₁ t₂ t₃ t₄) = TermIn.caseWhen op (TermIn.widen n' t₁) (TermIn.widen n' t₂) (TermIn.widen n' t₃) (TermIn.widen n' t₄)
- TermIn.widen n' (t₁.coalesce t₂) = (TermIn.widen n' t₁).coalesce (TermIn.widen n' t₂)
Instances For
Dependency graph
A comparison widened.
Equations
- BoolTerm.widen n' (BoolTerm.EQ a b) = BoolTerm.EQ (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.NE a b) = BoolTerm.NE (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.LE a b) = BoolTerm.LE (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.LT a b) = BoolTerm.LT (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.GE a b) = BoolTerm.GE (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.GT a b) = BoolTerm.GT (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.SYNEQ a b) = BoolTerm.SYNEQ (TermIn.widen n' a) (TermIn.widen n' b)
- BoolTerm.widen n' (BoolTerm.SYNNE a b) = BoolTerm.SYNNE (TermIn.widen n' a) (TermIn.widen n' b)
Instances For
Dependency graph
A selection widened.
Equations
- Selection.widen n' (Selection.BT b) = Selection.BT (BoolTerm.widen n' b)
- Selection.widen n' φ.Not = (Selection.widen n' φ).Not
- Selection.widen n' (φ₁.And φ₂) = (Selection.widen n' φ₁).And (Selection.widen n' φ₂)
- Selection.widen n' (φ₁.Or φ₂) = (Selection.widen n' φ₁).Or (Selection.widen n' φ₂)
- Selection.widen n' Selection.True = Selection.True
Instances For
Dependency graph
The two blocks of a doubled row #
The first block of a doubled row.
Equations
- AggQueryIn.blockL n x i = x (Fin.castAdd n i)
Instances For
Dependency graph
Dependency graph
Dependency graph
The frame and the window value read off the first block #
The window, kept #
Dependency graph
The doubled input: each row prefixed by its nulled copy, the
aggregate columns read as 0 as the window reads them.
Equations
- AggQueryIn.doubled κ q = AggQueryIn.castKind ⋯ (AggQueryIn.Proj (Fin.append (nullCols κ) fun (i : Fin n) => ProjColIn.term (TermGIn.index i ⋯)) q)
Instances For
Dependency graph
The columns kept after the window: the second block and the window's column.
Equations
- AggQueryIn.keptCols n = Fin.snoc (fun (i : Fin n) => ProjColIn.term (TermGIn.index (Fin.natAdd n i).castSucc ⋯)) (ProjColIn.token (Fin.last (n + n)) ⋯)
Instances For
Dependency graph
Dependency graph
A window over an input of any kinds, written over an all-regular input computing the same rows: the window over the doubled input, reading its first block – partition, order, term and clause moved there – and the first block then dropped.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
It computes the window, whatever the kinds of the input it stands for, as long as the rows agree.