Skip to content

Tests: four more cross-wheel golden cases: to_json text, to_arrow float lists, vector distances, integral DECIMAL (refs #314) - #446

Merged
tae898 merged 1 commit into
mainfrom
test/314-cross-wheel-golden-cases
Nov 22, 2026
Merged

tae898 merged 1 commit into
mainfrom
test/314-cross-wheel-golden-cases

Conversation

@tae898

@tae898 tae898 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

It adds the four cases that the status comment on #314 lists as not covered to tests/test_cross_wheel_golden.py: the text of Result.to_json(), float-list columns in to_arrow(), vector distances, and an integral DECIMAL in to_json_list(). It is a tests-only change. As in the first six tests, a committed literal is asserted on both wheels with no branch on arcadedb.__backend__.

I measured each case on both wheels first. Two of the four are the same on both wheels and two are not, so nothing here fails on main: where the wheels differ, the test pins the part that is equal and its docstring gives the value of each wheel.

  • to_arrow(): the same on both. A float[] is FixedSizeList<float32> and a LIST of floats is list<double>, also when every value would fit a float32. Pinned as type and values.
  • Result.to_json(): the text is the same for INTEGER, DOUBLE, LONG, NULL, and LIST, and that text is the golden. It differs for FLOAT and float[] (shortest float32 text on the JVM wheel, exact widening on the native wheel), for a DECIMAL (1.50 and 1.5), and for a DATE and a DATETIME of a projection row. A record row is compared after parsing, because the keys come in a different order, and its float32 values are compared as float32.
  • Integral DECIMAL in to_json_list(): the JVM wheel returns an int for a DECIMAL of scale 0 and the native wheel a float. The docstring of to_json_list() says a DECIMAL arrives as a float. The test asserts == 3 (true for both) and that the type is one of the two, and a float on both for Decimal("2.00").
  • Vector distances: distances that are exact in float32 (quantization="NONE", small whole numbers and halves) are the same bits on both wheels and are compared with == over 20 calls. Distances that round differ in the last float32 bits between the wheels, and between calls on the JVM wheel, so they are compared within 1e-5.

What each wheel returned

Run on the benchmark host (x86-64 Linux, Python 3.12) with scripts/dev_overlay.py, on the wheels CI built from 62195709b7: arcadedb-jvm on engine 26.12.1-SNAPSHOT and arcadedb on engine 26.11.1. The published arcadedb-jvm 26.11.1.post4 (engine 26.11.1) returned the same values as the JVM column, so the differences belong to the wheel and not to the engine version. The values are from a probe script over the table of the test with a few more columns (s, b, fl64, a 20-digit DECIMAL), which is why some rows show columns the test does not have.

Case arcadedb-jvm arcadedb (native)
to_json() projection, DOUBLE and LONG {"n":1,"d":0.3333333333333333,"big":-9007199254740993,"maybe":null,"s":"z","b":false} {"n":1,"d":0.3333333333333333,"big":-9007199254740993,"maybe":null,"s":"z","b":false} same
to_json() projection, LIST {"n":0,"lst":[1,"a",2.5],"fl":[0.5,0.25,-2.75],"fl64":[0.1,0.3333333333333333]} {"n":0,"lst":[1,"a",2.5],"fl":[0.5,0.25,-2.75],"fl64":[0.1,0.3333333333333333]} same
to_json() projection, FLOAT {"n":0,"f":0.1} {"n":0,"f":0.10000000149011612} differs
to_json() projection, float[] {"n":0,"v3":[0.1,0.33333334,0.5]} {"n":0,"v3":[0.10000000149011612,0.3333333432674408,0.5]} differs
to_json() projection, DECIMAL 1.50 "dec":1.50 "dec":1.5 differs
to_json() projection, DATE and DATETIME {"n":0,"day":1767312000000,"ts":"2026-01-02 03:04:05"} {"n":0,"day":20455,"ts":1767323045678} differs
to_json() record row, DATE and DATETIME "day":20455,"ts":1767323045678 "day":20455,"ts":1767323045678 same
to_json() record row, FLOAT "f":0.1 "f":0.10000000149011612 differs
to_arrow() type of float[] (3 values) field v3: fixed_size_list<item: float>[3] field v3: fixed_size_list<item: float>[3] same
to_arrow() type of float[] (9 values) field v9: fixed_size_list<item: float>[9] field v9: fixed_size_list<item: float>[9] same
to_arrow() type of a LIST of floats that fit a float32 field fl: list<item: double> field fl: list<item: double> same
to_arrow() type of a LIST of doubles field fl64: list<item: double> field fl64: list<item: double> same
to_arrow() values of float[] pylist v3: [[0.10000000149011612, 0.3333333432674408, 0.5], [0.5, 1.0, -2.75]] pylist v3: [[0.10000000149011612, 0.3333333432674408, 0.5], [0.5, 1.0, -2.75]] same
to_json_list() of Decimal("3") int 3 float 3.0 differs
to_json_list() of Decimal("-7") int -7 float -7.0 differs
to_json_list() of Decimal("2.00") float 2.0 float 2.0 same
to_json_list() of Decimal("12345678901234567890") (not in the test) int 12345678901234567890 float 1.2345678901234567e+19 differs
EUCLIDEAN, exact, vector 4 20.0 20.0 same
COSINE, exact, vector 4 0.3999999761581421 0.3999999761581421 same
COSINE, exact, vector 3 0.5 0.5 same
EUCLIDEAN, rounds, vector 4 19.670000076293945 19.670001983642578 differs
EUCLIDEAN, rounds, vector 5 2.869999408721924 2.869999885559082 differs
COSINE, rounds, vector 6 0.2547614574432373 0.25476133823394775 differs
COSINE, rounds, vector 7 0.21558117866516113 0.21558105945587158 differs

The native wheel returned the same distances on each of 400 calls. The JVM wheel on 26.12.1-SNAPSHOT returned the values above for the EUCLIDEAN search on 396 of 400 calls and the native values on the other 4; on 26.11.1 it returned the values above on all 400. I did not look into why.

The file passes on all three: 24 passed on the JVM wheel from main, 24 on the native wheel from main, and 24 on arcadedb-jvm 26.11.1.post4.

Related issues

Refs #314. It stays open: the differences above are not fixed here (the to_json() text, the int for a DECIMAL of scale 0 on the JVM wheel), and the cost of the longer float text on the JVM wheel is still to be measured.

Docs

None needed, no behaviour changes.

Checklist

  • A regression test fails on the old code and passes on the new (does not apply: no code changes, the tests describe main as it is)
  • The test suite that the change can affect passes (this file, on both wheels, as above)
  • uvx pre-commit run --files <changed files> passes

…at lists, vector distances, integral DECIMAL (refs #314)

The status comment on #314 lists four cases the golden file does not cover. Each new
test asserts what both wheels return alike, with a committed literal and no branch on
the backend.

Where the wheels differ today, the test pins the part that is equal and its docstring
gives the value of each wheel, so nothing here fails on main:
- Result.to_json(): the text is compared for INTEGER, DOUBLE, LONG, NULL and LIST; a
  record row is compared after parsing, the float32 values as float32. FLOAT, float[],
  DECIMAL, and DATE/DATETIME of a projection row have a different text per wheel.
- to_json_list(): a DECIMAL of scale 0 is an int on the JVM wheel and a float on the
  native wheel; 3 == 3.0 is asserted and the type is one of the two.
- vector distances: values that are exact in float32 are compared to the bit; values
  that round are compared within 1e-5, because the last float32 bits differ between
  the wheels and between calls on the JVM wheel.
- to_arrow(): the float-list columns are the same on both wheels (FixedSizeList<float32>
  for float[], list<double> for a LIST of floats).

Measured on the mini with scripts/dev_overlay.py: the wheels CI built from 6219570
(arcadedb-jvm on engine 26.12.1-SNAPSHOT, arcadedb on engine 26.11.1) and
arcadedb-jvm 26.11.1.post4; 24 passed on each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant