Repository navigation
Analytic windows: over, Window and then (HQL-0050) - #11
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The analytic windows of HQL-0050, and a total order for keyed selection.
overpartitions a sequence by a key, orders each partition, and gives one value per row, at the row's input position, from the row and itsWindow:over(by, order, into)inseq:orderis a key or a comparison; rows equal under it keep their input order. No row is merged or dropped.Window<T>incore:row_number,rank,dense_rank,lag,lead,first,last,size, and the framesrunning,rows(before, after)andwhole. Called as a step,w | row_number, or as a receiver,w.row_number().thenincollections:compare(a.at, b.at) | then(compare(a.seq, b.seq)), the second comparison evaluated only on a tie. A comparison that ends in a unique key is a total order, so keyed selection does not depend on input order.intowhose result holds aWindow, andoverof aStreamor aSet.sortis specified as stable, which it already was.Breaking
Windowis a standard type name, so a program's owntype Windowis refused, asGroupandPairalready are. The structural examples and the type-contracts page call their contractIntervalnow.Not in this PR
HQL-0050 is implemented in part. Carrying input position across splits, and keyed selection as a partial reduction, wait for a backend that splits;
localhostdoes not.Docs
A new book page, Part II's "Windows" under OLAP, a tie-rule paragraph on the Deduplication page, generated reference pages, the changelog, and HQL-0050's spec as built.
Testing
examples/windows/holds nine cases and two refusals, andexamples/pipelines/queries/ranked-deduplication.hqlruns the shop's replay throughover. The cases were written asproposedwith hand-computed results before the implementation, then promoted.cargo test --locked(653),cargo clippy --locked --all-targets,cargo fmt --checkandhql reference --checkpass locally;mkdocs build --strictwas not run locally (nomikeplugin here).