Repository navigation
feat: user predicates and aggregates (#180) - #20
Merged
Merged
Conversation
MiniGrafPredicate, MiniGrafAggregate and MiniGrafAccumulator, implementable from Kotlin and Java (lambdas for the one-method interfaces), and MiniGrafDb.registerPredicate/registerAggregate over the core's try_register_*. A throwing callback stops the query with QRY-014. Every MiniGrafDb method locks its handle only to clone the database, so a callback can call back into it. Shim code and Rust tests copied from minigraf-binding-template#9; core pin 7c8c5540 -> 02243f16. Kotlin and Java tests, consumer contract (predicate, aggregate, a throw is QRY-014), README "User functions". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
… review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x
10 tasks done
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.
minigraf#180 PR 4 (plan steps 17–20): user-defined predicates and aggregates in the JVM binding.
src/lib.rsgets minigraf-binding-template#9's code unchanged:MiniGrafUdfError, the threewith_foreigntraits (MiniGrafPredicate,MiniGrafAggregate,MiniGrafAccumulator),registerPredicate/registerAggregateover the core'stry_register_*, and handle locks that only clone the database. The template's Rust tests come with it.7c8c5540→02243f16(v3, after #757). The old pin already had #181 and #316; #306 needs no binding change.UdfTest, 12): predicate; aggregate in:findand:over;MiniGrafUdfException.Failedand any other exception →MiniGrafException.Querywith QRY-014 (exact messagejava.lang.IllegalStateException: own exception); failingstep; badReffromfinish; a predicate that queries the same db; cursors and prepared queries, including registration afterprepare; QRY-014 inside a cursor; INT-040 on a duplicate name; two threads in one predicate at once (barrier).MiniGrafUdfException.adult?,product, and a throw → QRY-014, from Java against the packaged jar.Verified on the bench machine: the new tests fail to compile against the old shim. With the new shim,
cargo test(44),./gradlew test(46) andconsumer-test/run.sh local(6 contract + quickstart) pass.Codex review: it said prepared queries capture the function registry at prepare time. That's not so (the core reads the snapshot when the executor opens), and a test now covers it. I declined its request to widen the consumer contract: the plan scopes it to one predicate and one aggregate.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Urda7FD9CYYoxdeGGJa11x