Skip to content

Native: RID offers the Java RID surface, Result.get_rid() takes a projected @rid - #531

Closed
tae898 wants to merge 2 commits into
native-previewfrom
parity/record-id-values-native
Closed

tae898 wants to merge 2 commits into
native-previewfrom
parity/record-id-values-native

Conversation

@tae898

@tae898 tae898 commented Oct 25, 2026

Copy link
Copy Markdown

The native wheel returns a record id inside a row as its own RID class; the JVM wheel returns the engine's RID. This PR makes the native class substitutable for the Java one in the places user code touches it, so a record id behaves the same on both wheels. The contract is written in docs/api/results.md under "Record ids in rows" (same text as the JVM PR, which carries the tests and docs for main): a record id in a row is an RID object, str(rid) is the text, equal RIDs hash alike, RIDs sort by bucket and position, getBucketId(), getPosition(), toString() and isValid() work, and it goes back in as a parameter and to lookup_by_rid().

What changes in _native/codec.py: RID gets ordering (<, <=, >, >=, by bucket then position, only against another RID) and the Java methods getBucketId, getPosition, toString, isValid, equals, compareTo. It still equals its own text and hashes like it, which the Java RID does not; the docs say to compare str(rid) and not to rely on either. What changes in _native/database.py: Result.get_rid() returns the identity of a row that projects @rid without an alias (SELECT @rid, name FROM T), as the JVM wheel does; it was None. Python only, no image rebuild.

Stacking and overlap with the open native PRs: none needs to merge first. The branch is on native-preview (91a6ad7). Files shared with open PRs are _native/database.py (#514, #521, #522, #525, #526) and _native/codec.py (#525); I merged each of those heads into this branch with git merge-tree and none conflicts. #520 and #523 do not touch my files.

Local checks: tests/test_record_id_values.py 12 passed on the native wheel (3 of them failed before this change: sorting, getBucketId, get_rid() of a projected @rid), run with ARCADEDB_BACKEND=native against an existing image (the #521 nnext image, no rebuild); with test_core.py, test_resultset.py, test_graph_api.py, test_vector.py, test_docs_examples.py the total is 127 passed, 24 skipped (the usual not-yet-native skips, no failures); pre-commit hooks passed. Not run: the full suite, the JVM wheel against this branch, CI.

🤖 Generated with Claude Code

tae898 and others added 2 commits October 25, 2026 17:34
…rojected @Rid (P-02)

A record id inside a row is an RID object on both wheels (docs/api/results.md, "Record ids in rows"). The native RID now sorts by bucket and position and has getBucketId, getPosition, toString, isValid, equals and compareTo, so code written against the JVM wheel's RID runs unchanged; it still equals its own text, which the JVM RID does not (documented as not to rely on). Result.get_rid() returns the identity of a row that projects @Rid without an alias, as the JVM wheel does. Python only, no image rebuild; tests/test_record_id_values.py runs on both wheels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…to the statement

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tae898

tae898 commented Oct 26, 2026

Copy link
Copy Markdown
Author

Closing here: the bindings moved to ArcadeData/arcadedb-python, and this change is merged there with the native port, ArcadeData/arcadedb-python#66 (commit 9ae92b3: the Java RID surface on the native RID, and Result.get_rid() for a projected @rid). The branch stays.

@tae898 tae898 closed this Oct 26, 2026
@tae898
tae898 deleted the parity/record-id-values-native branch November 8, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant