Repository navigation
Conversation
…oat32 matrix (closes #220) is_vector_candidate accepted only a list or an ndarray, so a chunk of vectors built with to_java_float_array (a JPype float[] on the JVM build) left the json-bulk path for _to_java_property_matrix. A JPype primitive array is read by numpy through the buffer protocol (float[] as float32, double[] as float64), so the candidate test now also accepts those two JPype types and split_float_vectors needs no new conversion. A column that starts with a Java array must hold only candidates; an int[], a long[], a null, a missing value, a ragged or an empty vector keep declining. insert_many shares the test and takes the same matrix. Native is unchanged: to_java_float_array returns a float32 ndarray there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Timed A/B (JVM build; arm A = main CI JVM wheel built from 413f54f, arm B = A's tree with only
By the rule this run is GRAY: every gating interval is below 1.00, but the control's median left [0.97, 1.03] on two shapes, and the rule then makes no speed claim. The control is the float32-ndarray path, which this PR does not change, and its intervals (and the A/A intervals beside them) are wide on this build, so the run did not separate the PR's effect from the noise of that path well enough for the rule. I will run it once more, unchanged (same arms, same rule, written before this run), and that second run decides: SHIP only if it meets the rule; if it is GRAY again, this PR is reported as not shown to help and left as a draft. |
|
Second timed run (the one declared final in the comment above; same arms, pins, rule and thresholds, 12 clean pairs per figure, B/A median with 95% CI, below 1 = B faster):
By the rule this run is GRAY again: every gating interval is below 1.00, but the control's median is outside [0.97, 1.03] on two shapes. As committed above, this PR is therefore reported as not shown to help by this study, makes no speed claim, and stays draft. For the record, the control's movement cannot come from this change: for a float32 ndarray |
|
Closing without merging: both timed runs above (the second declared final before it ran) came out inconclusive by the rule written before the first run, and speed was the only reason for the change, so the current path stays. The measurements remain here for reference. |
Closes #220
On the JVM wheel,
GraphBatch.create_vertices(andinsert_many) now send float vectors given as JPypefloat[]ordouble[](whatto_java_float_arrayreturns on that wheel) through the json-bulk plus binary float32 matrix path, instead of declining the whole chunk to_to_java_property_matrix.The change is in
src/arcadedb/type_conversion.py:is_vector_candidatealso accepts the two JPype array types (resolved once, after the JVM has started), andsplit_float_vectorsrequires every value of a column to be a candidate when its first value is a Java array. No new conversion call: numpy reads a JPype primitive array through the buffer protocol (float[]as float32,double[]as float64, which the split already casts to float32 as for float64 ndarrays), checked on JPype 1.7.1 and numpy 2.5.4. Stored values are bit-identical to the declined path; aJArray(JInt)orJArray(JLong), a null, a missing value, a ragged vector and an empty array keep declining as before.insert_manyshares the candidate test and takes the same matrix;insert_columnstakes whole columns and does not use it. The native wheel is untouched:to_java_float_arrayreturns a float32 ndarray there (vector.py,_native_enabled()branch) and the new test file is listed inNATIVE_NOT_APPLICABLE.Tests:
tests/test_jvm_vector_jarray.py(19 cases) spies onsplit_float_vectorsandGraphBatch._to_java_property_matrix. Run against the unchanged CI JVM wheel (whosetype_conversion.py,graph_batch.py,core.pyandvector.pyare byte-equal to main 1b315c1), 8 of 19 fail (the cases that need the new path) and 11 pass (the decline guards and the setup checks). The decline guards cannot fail on old code by construction, so they were checked against a mutant that accepts every Java array and drops the all-candidates check: 5 of them fail there. With the change, 19 of 19 pass, andtest_float_vector_bulk.py,test_graph_batch.py,test_numpy_support.py,test_type_conversion.pyandtest_vector_index_introspection.pystill pass (164 tests in all).Timing is not claimed here. Untimed probe figures are in #220 (load time of the
to_java_float_arrayshape was 2.0x to 2.4x that of float32 ndarray rows); a timed one-library A/B follows before this leaves draft.🤖 Generated with Claude Code