This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Repository navigation
Bindings: insert_many and insert_columns load a vertex type as vertices (JVM/native parity) - #519
Merged
Merged
Conversation
On the JVM wheel, insert_many into a VERTEX type raised ArcadeDBError (IllegalArgumentException: Cannot create a document of type ... because is not a document type), while the native wheel accepted it and stored vertices. The Java helper (DocumentBatcher) called db.newDocument for every row, and so did the Python per-row fallback for values the JSON text cannot carry. DocumentBatcher resolves the type once per call and calls db.newVertex for a vertex type, in all four entry points (insertManyJson, insertManyJsonParallel, insertColumns, insertColumnsParallel). An edge type is refused with a message that says why (an edge needs both endpoints); a missing type still raises the schema's SchemaException. The Python fallback uses new_vertex for a vertex type. Tests: TestInsertManyVertexType (synchronous, parallel, the non-JSON fallback, inside a caller's transaction with rollback and commit, insert_columns, insert_columns(parallel=True), an edge type, a missing type). Each load checks the count and that an edge can join two of the new records. The new class fails on the stock wheel (6 of 8) and passes with the fix. Docs: insert_many and insert_columns take a document or a vertex type. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(test-owned type names) 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Database.insert_manyinto a VERTEX type raised on the JVM wheel (ArcadeDBError: ... IllegalArgumentException: Cannot create a document of type 'Doc' because is not a document type), while the native wheel accepted the same call and stored vertices. Both wheels share one API, so the JVM wheel now does what the native one does.Cause
The Java helper
DocumentBatchercalleddb.newDocument(typeName)for every row, andnewDocumentrefuses a vertex type. The Python per-row fallback in_insert_many_chunk(values the JSON text cannot carry, such asdatetime) callednew_documentfor the same reason.Fix
DocumentBatcherresolves the type once per call (no per-row schema lookup) and callsdb.newVertexfor a vertex type, in all four entry points:insertManyJson,insertManyJsonParallel,insertColumns,insertColumnsParallel. Soinsert_columns(alsoparallel=True) loads a vertex type too.ArcadeDBError. A missing type still raises the schema's ownSchemaExceptiontext.new_vertexfor a vertex type.insert_manyandinsert_columnstake a document or a vertex type (docs/api/database.mdand the docstrings). No other doc or example saysinsert_manyis documents-only: the other mentions describe it as the document path, which it still is.insert_dataframeandinsert_arroware unchanged (a vertex type still goes throughGraphBatch.create_vertices()).Tests
New
TestInsertManyVertexTypeintests/test_bulk_insert.py: synchronous load,parallel=True, the non-JSON fallback, inside a caller's transaction (rollback leaves nothing, commit keeps all),insert_columns,insert_columns(parallel=True), an edge type, and a missing type. Each load checks the count and thatCREATE EDGEcan join two of the new records, which only works for real vertices. On the stock main wheel 6 of the 8 fail with the error above; with the fix all 8 pass.The same synchronous load on the native wheel (dev1 image) stores vertices and takes an edge, so the behaviour matches. Not part of this PR, noted for the native side: on that image
insert_many(..., parallel=True)into a vertex type still raises the sameIllegalArgumentException, because the parallel path goes through the Java helper. This PR fixes that helper for the JVM wheel.Local checks that ran
26.11.1.dev0,78e97b1cff): 6 failed, 2 passed (the edge-type and missing-type tests pass before and after).javac --release 21from this tree and overlaid on that wheel together with this tree's Python: new class 8 passed.test_bulk_insert.py,test_bridge_fixes.py,test_float_vector_bulk.py,test_insert_columns.py,test_dataframe_ingest.py,test_async_executor.py: 137 passed, 1 skipped (a skip those files already have). After the last edit (the isort pass of the pre-commit hook)test_bulk_insert.pyandtest_bridge_fixes.pyon the committed tree: 50 passed.black --check,isort(pre-commit hooks passed on commit).🤖 Generated with Claude Code