Visitar URL original
bindings docs and tests: known issues and strict xfail tripwires for … · humemai/arcadedb-embedded-python@d37db01 · GitHub
Skip to content

Commit d37db01

Browse files
tae898claude
andcommitted
bindings docs and tests: known issues and strict xfail tripwires for upstream ArcadeData#9277, ArcadeData#9278, and ArcadeData#9281
The openCypher COUNT ANTI-JOIN CHAIN push-down counts wrong when the far end of the chain has another label than the first hop's target (ArcadeData#9277; upstream ArcadeData#9271 lets id(a) <> id(b) reach it) and when the negated pattern's relationship has a property map (ArcadeData#9278), and sum() and avg() over a BYTE property raise IllegalArgumentException (ArcadeData#9281). Each entry has a workaround that is a plain test (a WITH before the WHERE, a conversion before the aggregate), tests of the cases that are not affected, and strict xfail tests of the wrong answers that start failing the suite when the engine fixes them. The plan check calls pytest.fail so a tripwire cannot pass by comparing the row pipeline with itself. Closes #197. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
1 parent 3e82926 commit d37db01

2 files changed

Lines changed: 398 additions & 0 deletions

File tree

‎bindings/python/docs/guide/known-issues.md‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,3 +708,73 @@ db = arcadedb.create_database(
708708

709709
There is no test of this entry: the miss needs a compaction that runs for seconds and
710710
searches that land inside it, too slow and too timing-dependent for the suite.
711+
712+
713+
## An openCypher count with a negated pattern in a chain is wrong when the far end has another label or the pattern has a property map
714+
715+
ArcadeDB [#9277](https://github.com/ArcadeData/arcadedb/issues/9277) and
716+
[#9278](https://github.com/ArcadeData/arcadedb/issues/9278); measured through the bindings on
717+
a 26.10.1 snapshot of upstream d36b4ca3ae, and in Java on that build, on 26.9.1, and on
718+
5a90b0f52a, on Temurin 21 and 25, with the same answers. Open.
719+
720+
A `MATCH` chain of two or more hops that ends in `RETURN count(*)` and has a negated pattern
721+
predicate between two of its nodes (`WHERE NOT (a)-[:R]-(c)`, alone or with `AND a <> c` or
722+
`AND id(a) <> id(c)`) is answered by a count push-down; `EXPLAIN` lists `COUNT ANTI-JOIN
723+
CHAIN`. It counts wrong in two cases:
724+
725+
- **Another label at the far end (#9277).** On the single path
726+
`(x0:Person)-[:KNOWS]-(x1:Person)-[:KNOWS]-(y0:Employee)-[:HAS_INTEREST]->(t:Tag)`, in which
727+
`x0` and `y0` are not connected, the chain `(p1:Person)...(p2:Person)...(p3:Employee)...(t:Tag)`
728+
with `WHERE NOT (p1)-[:KNOWS]-(p3)` counted 0 where the answer is 1. The same holds with
729+
`AND p1 <> p3`. A chain whose nodes all have the same label, and a far end that is a sub type
730+
of the first labels, gave the right count in every case I ran. From the snapshot that carries
731+
upstream #9271, `id(p1) <> id(p3)` takes the same push-down, so that spelling, which counted 1
732+
before, now counts 0.
733+
- **A property map on the pattern's relationship (#9278).** The push-down drops it. With an edge
734+
`x -[:K {w: 0}]-> z`, `WHERE NOT (x)-[:K {w: 1}]->(z)` counted 0 where the answer is 1,
735+
because no edge with `w = 1` connects them; it was counted as `NOT (x)-[:K]->(z)`.
736+
737+
Put the variables through a `WITH` before the `WHERE`. That keeps the query off the push-down,
738+
and the row pipeline counted the right number in every case above. It gives up the push-down's
739+
speed for that query:
740+
741+
```python
742+
chain = "MATCH (p1:Person)-[:KNOWS]-(p2:Person)-[:KNOWS]-(p3:Employee)-[:HAS_INTEREST]->(t:Tag) "
743+
n = (
744+
db.query(
745+
"opencypher",
746+
chain + "WITH p1, p2, p3, t WHERE NOT (p1)-[:KNOWS]-(p3) RETURN count(*) AS n",
747+
)
748+
.first()
749+
.get("n")
750+
)
751+
```
752+
753+
Tests: `tests/test_count_pushdown_known_issues.py` checks the `WITH` workaround and the cases
754+
that are not affected, and has strict `xfail` tests of the wrong counts; they start failing the
755+
suite when the engine fixes them, which is the cue to remove this entry.
756+
757+
758+
## `sum()` and `avg()` over a `BYTE` property raise `IllegalArgumentException`
759+
760+
ArcadeDB [#9281](https://github.com/ArcadeData/arcadedb/issues/9281); measured through the
761+
bindings on a 26.10.1 snapshot of upstream d36b4ca3ae, and in Java on that build, on 26.9.1, and
762+
on 5a90b0f52a, on Temurin 21 and 25. Open.
763+
764+
Over a property declared `BYTE`, `SELECT sum(b) FROM T` and `SELECT avg(b) FROM T` in SQL and
765+
`MATCH (n:V) RETURN sum(n.b)` in openCypher raise `ArcadeDBError` (`Query failed:
766+
java.lang.IllegalArgumentException: Cannot increment value '100' (class java.lang.Byte) with
767+
'50' (class java.lang.Byte)`) once the aggregate has two rows to add. The same values in a
768+
`SHORT` or `INTEGER` property sum and average as expected.
769+
770+
Convert the value before the aggregate, `b.asInteger()` in SQL and `toInteger(n.b)` in
771+
openCypher, or declare the property `SHORT`:
772+
773+
```python
774+
total = db.query("sql", "SELECT sum(b.asInteger()) AS total FROM T").first().get("total")
775+
average = db.query("sql", "SELECT avg(b.asInteger()) AS average FROM T").first().get("average")
776+
```
777+
778+
Tests: `tests/test_count_pushdown_known_issues.py` checks the conversion workaround and has strict
779+
`xfail` tests of the failing aggregates; they start failing the suite when the engine fixes them,
780+
which is the cue to remove this entry.

0 commit comments

Comments
 (0)