Repository navigation
Native: columnar bulk insert by address for strings, nulls and vectors (no JSON text) - #72
Merged
Merged
Conversation
…s (no JSON text) Port of humemai/arcadedb-embedded-python#514 onto the P-04 port fix. - arcadedb_n_insert_colp: the image reads whole columns in place (int64, float64, bool, int32, float32, UTF-8 strings as Arrow offsets plus bytes, float32 vector matrices, an Arrow validity bitmap per column), no JSON text and no per-value crossing. - _native/columnar.py lays the columns out (numpy, lists of one value type with None as null, lists of float32 arrays, pyarrow arrays); _native/bulk.py sends them; insert_many chunks and the DataFrame/Arrow document load use the entry when every column maps to a supported kind, any other batch keeps the JSON path. - Only a float32 matrix (or a list of float32 arrays) is a column of vectors, as on the JPype path (tests/test_float_vector_bulk.py); #514 took any float matrix. The pack test says so. - New tests: test_native_columnar_pack.py (no native library needed, runs on both backends) and test_native_columnar_insert.py (compares the stored records of the JSON and the columnar entry points, native backend only, collect_ignore otherwise). - The two new test files use plain imports of numpy, pandas and pyarrow, not importorskip (the repo's no-skips policy). Needs a rebuilt native library (BulkOps.java, ArcadeNative.java). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…umnar-port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tae898
added a commit
that referenced
this pull request
Oct 25, 2026
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.
Lands after #71. This PR is stacked on
p04-port-fix(base branch of this PR); retarget it to the branch #71 merges into once #71 lands.What it is
A port of humemai/arcadedb-embedded-python#514 (native: columnar bulk insert by address for strings, nulls and vectors, no JSON text). The native image gets one new entry point,
arcadedb_n_insert_colp. Python lays whole columns out in memory (int64, float64, bool, int32, float32, UTF-8 strings as Arrow offsets plus bytes, float32 vector matrices, an Arrow validity bitmap per column) and hands the addresses over. The image builds the documents without a JSON parser and without a crossing per value.src/arcadedb/_native/columnar.py(new) decides the layout of each column. A column it cannot lay out (nested values, mixed types, date-times, decimals, integers past 64 bits) makes the whole call use the JSON path, so nothing is half sent.src/arcadedb/_native/bulk.pysends the columns.insert_columnsandinsert_manychunks use it when every column maps to a supported kind.ARCADEDB_NATIVE_BULK=0turns it off.src/arcadedb/dataframe.py: the native document load keeps string columns and numeric columns with nulls as Arrow arrays and reads them in place.native/src/main/java/org/humemai/nativelib/{BulkOps,ArcadeNative}.java: the image side. This needs a rebuilt native library.tests/test_native_columnar_pack.py(needs no native library, backend-neutral, so it runs on both backends) andtests/test_native_columnar_insert.py(compares the stored records of the JSON path and the columnar path, native only, listed incollect_ignoreon the JVM backend like the other native-only files).Speed (measured in the humemai repo, not re-measured here)
The laptop A/B of #514 against the old native code passed its speed rule: DataFrame/Arrow insert took 0.398 of the old time (95% interval 0.395 to 0.399) and insert of dict rows took 0.437 (0.434 to 0.440). The run notes are in the private notes of the humemai repo (
native-columnar-ab-laptop-20261025in its bench repros). The A/B ran the original #514 code. This port differs from it in one rule that does not touch the columns the A/B used (see below).Differences from #514
tests/test_float_vector_bulk.pypins that), socolumnar.pyfollows it andtest_native_columnar_pack.pyhas one test changed (float32 input) plus one new test (float64 stays on the row path). Strings, nulls, ints, 1-D floats, bools and float32 vectors are as in #514.pytest.importorskip(the repo's no-skips policy). Thearcadedb_embeddednames becamearcadedb;scripts/check_no_embedded_name.pyis clean.Hunk-by-hunk port check
I diffed every hunk of #514 (the three commits, 11 files) against this branch. The earlier port 99a9dc2 dropped Java hunks silently, so the Java files were compared byte for byte.
native-spike/.../BulkOps.javanative-spike/.../ArcadeNative.javaarcadedb/_nativeon the base._native/bulk.py_native/columnar.py_native/database.pyinsert_manydocstring, the call in_insert_chunk, theinsert_rows_columnarimport; the import was added by hand because the base orders imports differently)._native/lib.pyarcadedb_n_insert_colpsignature).dataframe.pytests/conftest.pycollect_ignoreoftest_native_columnar_insert.pyoff the native backend).tests/test_native_columnar_insert.pytests/test_native_columnar_pack.pydocs/development/bridge.mddocs/modules/ROOT/pages/developmentholdsci.adocandrelease.adoconly).Tests
Native image rebuilt once from this branch (GraalVM CE 25.4.4.1.1, engine 26.10.2,
-march=compatibility, through the laptop job gate). A wheel was built against that image andnative/wheel/parity_wheel.pyran these files, one process each, on the native backend:No failures, errors, timeouts or other skips. The NOTYET and NA-JVM counts of the files that existed before are the same as in the earlier parity run. On the JVM backend (run from the source tree),
test_native_columnar_pack.pypasses (26) and a whole-directory collection leavestest_native_columnar_insert.pyout. Not run here: the rest of the JVM-backend suite (the JVM code paths ofdataframe.pyare unchanged: the newarrowargument defaults to off) and the full native parity of all other files.Lint: Bandit 1.9.4 (
-c pyproject.toml -r src tests --severity-level low --confidence-level low) reports no issues, black 26.10.1 and isort 9.0.2 (--profile black) are clean onsrcandtests, andcheck_no_embedded_name.pypasses.🤖 Generated with Claude Code