Repository navigation
Bind positional integer and bool ndarrays as lists, not float[] - #143
Merged
Merged
Conversation
Database._convert_args sent every ndarray through to_java_float_array. Only float arrays (query vectors) keep that path now; other dtypes use convert_python_to_java, matching a Python list and the native build. 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.
Closes #142
Database._convert_args(src/arcadedb/core.py) sent every positionalnp.ndarrayparameter throughto_java_float_array, so on the JVM build an int or bool array arrived as a Javafloat[](ints as floats, int64 past 2**24 rounded, bools as 1.0 and 0.0). Now only float arrays (query vectors) take that path; any other dtype goes throughconvert_python_to_java, which binds the listtolist()gives (Long for ints, Boolean for bools), the same as a Python list and the same as the native build, whose encoder sends non-float arrays astolist().Dtype mapping on the positional path: float kinds keep
float[]; int8 to int64 and uint types bind as the list of Python ints (Long); bool as Boolean. I did not addint[]/long[]crossings, because the native build and the list form already bind a list and the engine converts it intoARRAY_OF_INTEGERS/ARRAY_OF_LONGS. The named-parameter and document-property paths already usedconvert_python_to_javaand are unchanged.Tests (
tests/test_numpy_support.py, run on both builds): positional int8/16/32/64 and uint8 arrays bind as ints equal to the list form, an int64 array holding2**53 + 1is exact, a bool array stays boolean, int32 and int64 arrays inserted intoARRAY_OF_INTEGERS/ARRAY_OF_LONGSread back as ints, and the named-parameter anddoc.setpaths are pinned. The positional tests fail on the old code because[1, 2, 3]came back as floats (and2**53 + 1rounded); the property and named tests already passed and only guard against regression. Not run locally (tests run against a built wheel in CI).🤖 Generated with Claude Code