Repository navigation
insert_many and insert_columns load a vertex type as vertices (JVM/native parity) - #47
Merged
Merged
Conversation
On the JVM build, insert_many into a VERTEX type raised ArcadeDBError (IllegalArgumentException: Cannot create a document of type ... because is not a document type), while the native build 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 bridge jar (6 of 8) and passes with the fix. Port of humemai/arcadedb-embedded-python#519. 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 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
Port of humemai/arcadedb-embedded-python#519.
Database.insert_manyinto a VERTEX type raised on the JVM build (ArcadeDBError: ... IllegalArgumentException: Cannot create a document of type 'Doc' because is not a document type), while the native build accepted the same call and stored vertices. Both builds share one API, so the JVM build 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, and theinsert_many/insert_columnsdocstrings say a vertex type is accepted. This repo's Antora docs do not describeinsert_manyyet, so there is no page to change.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. With the stock bridge jar and this repo's unchanged Python, 6 of the 8 fail with the error above; with the fix all 8 pass.Local checks that ran
26.11.1-SNAPSHOT, from the mainhumemaiwheel) with this repo's unchangedsrc/arcadedb: 6 failed, 2 passed (the edge-type and missing-type tests pass before and after).javac --release 21from this tree'ssrc/javaand overlaid on those jars together with this tree'ssrc/arcadedb: new class 8 passed;test_bulk_insert.py,test_bridge_fixes.py,test_float_vector_bulk.py,test_bulk_json_paths.py,test_async_executor.py: 163 passed.test_bulk_insert.pyandtest_bridge_fixes.py: 50 passed. The change uses nothing newer than 3.10.black --check,isort --profile blackon the touched files (the pre-commit hooks passed on commit).🤖 Generated with Claude Code