Repository navigation
Description
When CREATE INDEX FOR (n:A) ON (n.x) runs before any A record has x, the property stays undeclared and the index falls back to STRING keys (the behavior added for #4222, in executeCreateIndex). After that, an integer and a float with the same value no longer find each other through the index. With the index, MATCH (n:A {x: 3}), WHERE n.x = 3, and WHERE n.x IN [3] miss the node that holds 3.0, WHERE n.x = 7.0 misses the node that holds 7, and MERGE (n:A {x: 3}) creates a third node instead of matching the one that holds 3.0. Without the index, every query finds its node, because 3 = 3.0 is true in Cypher. The results fit the two numbers being serialized to different string keys.
Neo4j 2026.08.1 gives the same rows with and without its own index on A.x, created first: [1], [1], [1], [2], the MERGE returns 1, and the type still has two nodes.
#8882 made FLOAT and DOUBLE equality agree across an index, a scan, and Cypher for a declared property; here the property is undeclared and the keys are strings. Creating the index before loading is a common order (the loader in #4222 does it), and a source such as JSON can write some whole numbers without a decimal point and others with one, so one property can end up holding both types.
Repro
javac -cp 'lib/*' -d cls IndexFirstNumeric.java
java -Xmx8g -XX:+UseCompactObjectHeaders --add-modules=jdk.incubator.vector --enable-native-access=ALL-UNNAMED -cp 'lib/*:cls' IndexFirstNumeric /tmp/IndexFirstNumeric-dblib/ holds the engine jar and its dependencies. On Temurin 21, use the same command without -XX:+UseCompactObjectHeaders.
import com.arcadedb.database.Database;
import com.arcadedb.database.DatabaseFactory;
import com.arcadedb.query.sql.executor.ResultSet;
import java.util.ArrayList;
import java.util.List;
public class IndexFirstNumeric {
public static void main(String[] args) {
System.out.println("ArcadeDB " + com.arcadedb.Constants.getRawVersion() + " (" + com.arcadedb.Constants.getBuildNumber() + "), Java "
+ System.getProperty("java.version"));
String[] queries = {
"MATCH (n:A {x: 3}) RETURN n.id AS id",
"MATCH (n:A) WHERE n.x = 3 RETURN n.id AS id",
"MATCH (n:A) WHERE n.x IN [3] RETURN n.id AS id",
"MATCH (n:A) WHERE n.x = 7.0 RETURN n.id AS id",
"MERGE (n:A {x: 3}) ON CREATE SET n.id = 99 RETURN n.id AS id",
"MATCH (n:A) RETURN n.id AS id, n.x AS x ORDER BY id" };
for (boolean index : new boolean[] { false, true }) {
Database db = fresh(args[0] + (index ? "-index" : "-noindex"));
if (index)
db.command("opencypher", "CREATE INDEX FOR (n:A) ON (n.x)"); // created before any A exists
db.transaction(() -> db.command("opencypher", "CREATE (:A {id: 1, x: 3.0}), (:A {id: 2, x: 7})"));
System.out.println(index ? "-- CREATE INDEX FOR (n:A) ON (n.x) first, then the data" : "-- no index");
for (String q : queries)
System.out.println(q + " -> " + rows(db, q));
db.close();
}
}
static List<String> rows(Database db, String q) {
List<String> out = new ArrayList<>();
db.transaction(() -> {
try (ResultSet rs = db.command("opencypher", q)) {
rs.stream().forEach(r -> out.add(r.toJSON().toString()));
}
});
return out;
}
static Database fresh(String path) {
DatabaseFactory factory = new DatabaseFactory(path);
if (factory.exists())
factory.open().drop();
return factory.create();
}
}Output on main at cecb369df9 (2026-10-03), embedded, on Temurin 25 with compact object headers (the engine jar's build stamp names 04bb03ebec, the newest commit in cecb369df9 that is not a merge). Temurin 21 prints the same lines apart from the Java version on the first line.
ArcadeDB 26.10.1-SNAPSHOT (04bb03ebec07fce19101595d65ca1e3bdf516755), Java 25.0.4
-- no index
MATCH (n:A {x: 3}) RETURN n.id AS id -> [{"id":1}]
MATCH (n:A) WHERE n.x = 3 RETURN n.id AS id -> [{"id":1}]
MATCH (n:A) WHERE n.x IN [3] RETURN n.id AS id -> [{"id":1}]
MATCH (n:A) WHERE n.x = 7.0 RETURN n.id AS id -> [{"id":2}]
MERGE (n:A {x: 3}) ON CREATE SET n.id = 99 RETURN n.id AS id -> [{"id":1}]
MATCH (n:A) RETURN n.id AS id, n.x AS x ORDER BY id -> [{"id":1,"x":3.0}, {"id":2,"x":7}]
-- CREATE INDEX FOR (n:A) ON (n.x) first, then the data
MATCH (n:A {x: 3}) RETURN n.id AS id -> []
MATCH (n:A) WHERE n.x = 3 RETURN n.id AS id -> []
MATCH (n:A) WHERE n.x IN [3] RETURN n.id AS id -> []
MATCH (n:A) WHERE n.x = 7.0 RETURN n.id AS id -> []
MERGE (n:A {x: 3}) ON CREATE SET n.id = 99 RETURN n.id AS id -> [{"id":99}]
MATCH (n:A) RETURN n.id AS id, n.x AS x ORDER BY id -> [{"id":1,"x":3.0}, {"id":2,"x":7}, {"id":99,"x":3}]
Versions affected: main cecb369df9, main 66541f57d9 (2026-10-02), main 417314c18 (2026-09-17), and 26.9.1 print the same lines, on Temurin 25 and Temurin 21.
Expected: the index does not change any answer: each query returns the rows it returns without the index, and the MERGE matches node 1.
Activity
github-actions commentedon Oct 3, 2026
Merged into #9000, which now tracks this together with the other related issues in engine. Closing here as a duplicate - reopen this issue if the grouping is wrong.
tae898 commentedon Oct 3, 2026
Verified on the merge commit 9c4e264 (it contains #9107 and #9132; engine, server and plugin jars built from it), the repro from the description, on JDK 25 (compact object headers) and JDK 21. The output is the same on both JDKs. This is
IndexFirstNumeric, the part whereCREATE INDEXruns before the data.MATCH (n:A {x: 3})[][{"id":1}]WHERE n.x = 3[][{"id":1}]WHERE n.x IN [3][][{"id":1}]WHERE n.x = 7.0[][{"id":2}]MERGE (n:A {x: 3}) ON CREATE SET n.id = 99The no-index rows are the same before and after, and the indexed rows now equal them.
Thanks for the fix.
fix: compaction no longer drops concurrent commits, FLOAT signed zero…
fix: compaction no longer drops concurrent commits, FLOAT signed zero…
fix(ArcadeData#11578): a list holding arrays keys by its content, and…
fix(#11578): an index key of an undeclared property holds the text of…