Add null and range predicates, variadic and/or, DISTINCT and row locks - #16
Merged
Merged
Conversation
- isNull, isNotNull, between and notBetween on every expression; the ends of a range are encoded through the column, like a comparison. - CH.and / CH.or take any number of conditions, skip undefined ones, write one flat group, and return undefined when none are left. and keeps tenant evidence; or drops it, as .and / .or do. - distinct() and distinctOn(...aliases) on queries, both dialects. - forUpdate / forNoKeyUpdate / forShare / forKeyShare with skipLocked, noWait and of, written after LIMIT. DialectClauses.locking gates them; ClickHouse refuses at compile. - compile(query) takes params as optional, so a query without params no longer falls through to the write overload with a confusing error. Each feature runs in the shared core suite on Postgres and on both ClickHouse matrix servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (22)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
From review: a qualified name in a lock's OF (Postgres takes only unqualified names), a lock on a query with DISTINCT, GROUP BY or HAVING, and a lock on a unionAll branch were all compiled and then refused by the server; they are now QueryBuilderDefects. distinctOn() with no keys silently became a whole-row DISTINCT; it is now a defect too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Next items from
design/gap-review.md: DISTINCT (~10 Maple sites), row locks (7), and the null and range predicates every query builder has.What changes
isNull(),isNotNull(),between()andnotBetween()on everyExpr. The ends of a range are encoded through the column's codec.CH.and(...)/CH.or(...)take any number of conditions, skipundefinedones, write one flat group, and returnundefinedwhen none are left (whichwherethen skips).andkeeps tenant evidence;ordrops it.distinct()/distinctOn(...aliases)work on both dialects; ClickHouse 26.2 and 26.8 accept DISTINCT ON.forUpdate/forNoKeyUpdate/forShare/forKeySharetake{ skipLocked, noWait, of }and are written after LIMIT. New optionalDialectClauses.locking; ClickHouse refuses with a defect.compile(query)no longer needs a params argument for a query with no params. Before this, such a call fell through to the write overload with a confusing type error.isNulldocs example now uses the built-in instead of a hand-declareddefineCondFn.Testing
bun run typecheckandbun run test: 550 unit tests and the doc checks pass.FOR UPDATE SKIP LOCKEDinsideDatabase.transaction, plus DISTINCT ON,BETWEENandIS NULL.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.