GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — openCypher: an equality on the first property of a composite `HASH` index throws "does not support ordered iterations" instead of scanning (follow-up to #8835) · Issue #9236 · ArcadeData/arcadedb

openCypher: an equality on the first property of a composite HASH index throws "does not support ordered iterations" instead of scanning (follow-up to #8835) #9236

New issue
Copy link
New issue
Copy link
Closed
#9252
Closed
openCypher: an equality on the first property of a composite HASH index throws "does not support ordered iterations" instead of scanning (follow-up to #8835)#9236
#9252
Copy link
Assignees
lvca
Labels
bugengineCore engine: document/schema APIopencypherseverity:minorCosmetic, documentation, edge case, or a workaround exists
Milestone
26.10.1

Description

@tae898
tae898
opened on Oct 4, 2026
Issue body actions

With a composite hash index on (p, q), an openCypher MATCH that constrains only p (WHERE n.p = 1, {p: 1}, WHERE n.p IN [1, 2]), or both with a parameter for q that is null, throws UnsupportedOperationException: Index 'Hash[p,q]' does not support ordered iterations. The same queries answer on the type without an index and on an LSM_TREE index on (p, q), an equality on both properties answers through the hash index, and SQL WHERE p = 1 answers on all four types (it does not plan the hash index for a prefix). #8835 fixed the same exception for a range on a property whose only index is a hash index; this is the prefix of a composite one.

Where (at 1addb51950): NodeIndexSeek reads a key shorter than the index with a range cursor, index.range(true, key, true, key, true) ("a shorter one matches a contiguous range of the ordered index, which only the range cursor can walk"), which a hash index cannot serve. A key is shorter when the query names only the first property, and also when a parameter for a later property is null, because the key is cut at the first null (L183-L188). The anchor is chosen by AnchorSelector.findIndexForProperty, which returns a composite index whose first property matches ("can use index prefix", L511-L513) unless it is called with orderedOnly. The range path calls it that way since #8835 (L302-L303); the equality and IN paths (L201, L235) do not, so they take a composite hash index for its first property alone.

Repro

# lib/ holds the engine jar built at the commit under test and its dependencies
javac -cp 'lib/*' -d cls CypherHashCompositePrefix.java
java -Xmx2g -XX:+UseCompactObjectHeaders --add-modules=jdk.incubator.vector --enable-native-access=ALL-UNNAMED -cp 'lib/*:cls' CypherHashCompositePrefix ./db
import com.arcadedb.database.*;
import com.arcadedb.query.sql.executor.*;

import java.util.*;

public class CypherHashCompositePrefix {
  public static void main(String[] args) {
    System.out.println("ArcadeDB " + com.arcadedb.Constants.getRawVersion() + " (" + com.arcadedb.Constants.getBuildNumber() + "), Java "
        + System.getProperty("java.version"));
    try (Database db = new DatabaseFactory(args[0]).create()) {
      final String[][] types = { { "Scan", null }, { "Lsm", "NOTUNIQUE" }, { "Hash", "NOTUNIQUE_HASH" }, { "UniqueHash", "UNIQUE_HASH" } };
      for (String[] t : types) {
        db.command("sql", "CREATE VERTEX TYPE " + t[0]);
        db.command("sql", "CREATE PROPERTY " + t[0] + ".p INTEGER");
        db.command("sql", "CREATE PROPERTY " + t[0] + ".q INTEGER");
        if (t[1] != null)
          db.command("sql", "CREATE INDEX ON " + t[0] + " (p, q) " + t[1]);
        db.transaction(() -> {
          db.newVertex(t[0]).set("p", 1, "q", 5).save();
          db.newVertex(t[0]).set("p", 2, "q", 6).save();
        });
      }
      System.out.println("Each type holds (p, q) = (1, 5), (2, 6); the index is on (p, q)");
      final Map<String, Object> params = new HashMap<>();
      params.put("p", 1);
      params.put("q", null);
      for (String q : new String[] { "MATCH (n:%s) WHERE n.p = 1 RETURN n.p AS p", "MATCH (n:%s {p: 1}) RETURN n.p AS p",
          "MATCH (n:%s) WHERE n.p IN [1, 2] RETURN n.p AS p", "MATCH (n:%s) WHERE n.p = 1 AND n.q = 5 RETURN n.p AS p",
          "MATCH (n:%s) WHERE n.p = $p AND n.q = $q RETURN n.p AS p", "SELECT p FROM %s WHERE p = 1" }) {
        System.out.println("  " + q.replace("%s", "T") + (q.contains("$q") ? "  with $p = 1, $q = null" : ""));
        for (String[] t : types)
          try (ResultSet rs = db.query(q.startsWith("MATCH") ? "cypher" : "sql", String.format(q, t[0]), params)) {
            final List<Object> ps = new ArrayList<>();
            rs.forEachRemaining(r -> ps.add(r.getProperty("p")));
            System.out.printf("    %-10s %s%n", t[0], ps);
          } catch (Exception e) {
            System.out.printf("    %-10s %s: %s%n", t[0], e.getClass().getName(), e.getMessage());
          }
      }
    }
  }
}

Output on main 1addb51950 (the engine jar's build stamp is 1addb51950), Temurin 25.0.4 with -XX:+UseCompactObjectHeaders:

ArcadeDB 26.10.1-SNAPSHOT (1addb519505253cbad99d1744d1abd23972928a8), Java 25.0.4
Each type holds (p, q) = (1, 5), (2, 6); the index is on (p, q)
  MATCH (n:T) WHERE n.p = 1 RETURN n.p AS p
    Scan       [1]
    Lsm        [1]
    Hash       java.lang.UnsupportedOperationException: Index 'Hash[p,q]' does not support ordered iterations
    UniqueHash java.lang.UnsupportedOperationException: Index 'UniqueHash[p,q]' does not support ordered iterations
  MATCH (n:T {p: 1}) RETURN n.p AS p
    Scan       [1]
    Lsm        [1]
    Hash       java.lang.UnsupportedOperationException: Index 'Hash[p,q]' does not support ordered iterations
    UniqueHash java.lang.UnsupportedOperationException: Index 'UniqueHash[p,q]' does not support ordered iterations
  MATCH (n:T) WHERE n.p IN [1, 2] RETURN n.p AS p
    Scan       [1, 2]
    Lsm        [1, 2]
    Hash       java.lang.UnsupportedOperationException: Index 'Hash[p,q]' does not support ordered iterations
    UniqueHash java.lang.UnsupportedOperationException: Index 'UniqueHash[p,q]' does not support ordered iterations
  MATCH (n:T) WHERE n.p = 1 AND n.q = 5 RETURN n.p AS p
    Scan       [1]
    Lsm        [1]
    Hash       [1]
    UniqueHash [1]
  MATCH (n:T) WHERE n.p = $p AND n.q = $q RETURN n.p AS p  with $p = 1, $q = null
    Scan       []
    Lsm        []
    Hash       java.lang.UnsupportedOperationException: Index 'Hash[p,q]' does not support ordered iterations
    UniqueHash java.lang.UnsupportedOperationException: Index 'UniqueHash[p,q]' does not support ordered iterations
  SELECT p FROM T WHERE p = 1
    Scan       [1]
    Lsm        [1]
    Hash       [1]
    UniqueHash [1]

Temurin 21.0.12 printed the same lines apart from the Java version on the first line.

Versions affected: main 417314c18d (2026-09-17) printed the same lines apart from the first line, on Temurin 25 and 21.

Expected: the four MATCH queries return [1] ([1, 2] for the IN list, [] for the null $q) on Hash and UniqueHash as they do on Scan and Lsm: the planner does not choose a hash index unless the query gives every property of its key, or the seek falls back to the label scan, as SQL does.

Duplicates checked: gh search issues --repo ArcadeData/arcadedb for "does not support ordered iterations", "composite hash index cypher", "NodeIndexSeek hash", "hash index prefix", and "openCypher HASH composite". Near misses: #8835 (closed: an openCypher range on a property whose only index is a hash index, the same exception) and #9144 (closed: the same for a Gremlin range). I found no issue for the prefix of a composite hash index.

Activity

  1. github-actions
    added
    bug
    engineCore engine: document/schema API
    opencypher
    severity:minorCosmetic, documentation, edge case, or a workaround exists
    on Oct 4, 2026
  2. lvca
    added
    in progressThe team is actively working on this issue
    on Oct 4, 2026
  3. lvca
    self-assigned this
    on Oct 4, 2026
  4. lvca
    added this to the 26.10.1 milestone on Oct 4, 2026
  5. lvca
    added a commit that references this issue on Oct 5, 2026

    Merge pull request #9252 from ArcadeData/fix/9245-9241-9236-9237-9240…

    9c329ca
  6. lvca
    closed this as completedin #9252on Oct 5, 2026
  7. lvca commented on Oct 5, 2026

    @lvca
    lvca
    on Oct 5, 2026
    Member
    More actions

    Fixed in #9252 (26.10.1). A composite HASH index is now only used when the query constrains all its columns. A condition on the first column alone (or a null parameter for a later one) no longer throws "does not support ordered iterations": it is answered by a scan or another index.

    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  8. lvca
    removed
    in progressThe team is actively working on this issue
    on Oct 5, 2026
  9. tae898
    added a commit that references this issue on Oct 5, 2026

    bindings: ArcadeData#9237 and ArcadeData#9236 tripwires become plain …

    d012d82
  10. tae898 commented on Oct 5, 2026

    @tae898
    tae898
    on Oct 5, 2026
    ContributorAuthor
    More actions

    Checked on upstream main 3543960 (the commit that contains #9252, #9250 and #9251; engine jars built by CI from that commit, no ha-raft shaded jar on the classpath) against 9fbef12 (main before those three merges). The repro is the one filed in this issue, unchanged. One JVM per run, in a container limited to 2 cores and 2 GB (-Xmx1g), on Temurin 25.0.4 with -XX:+UseCompactObjectHeaders and on Temurin 21.0.12.

    Verdict: fixed on both JDKs. Of the 12 cells of the filed repro for the two composite hash indexes, 8 threw "does not support ordered iterations" before the fix (the equality, the {p: 1} map, IN, and the null $q parameter, on both Hash and UniqueHash) and 0 throw after it; each of them now returns the same rows as the type without an index and the LSM_TREE index.

    query scan and Lsm index (all arms) Hash before Hash after UniqueHash before UniqueHash after
    MATCH (n:T) WHERE n.p = 1 RETURN n.p AS p [1] / [1] UnsupportedOperationException [1] UnsupportedOperationException [1]
    MATCH (n:T {p: 1}) RETURN n.p AS p [1] / [1] UnsupportedOperationException [1] UnsupportedOperationException [1]
    MATCH (n:T) WHERE n.p IN [1, 2] RETURN n.p AS p [1, 2] / [1, 2] UnsupportedOperationException [1, 2] UnsupportedOperationException [1, 2]
    MATCH (n:T) WHERE n.p = 1 AND n.q = 5 RETURN n.p AS p [1] / [1] [1] [1] [1] [1]
    MATCH (n:T) WHERE n.p = $p AND n.q = $q RETURN n.p AS p with $p = 1, $q = null [] / [] UnsupportedOperationException [] UnsupportedOperationException []
    SELECT p FROM T WHERE p = 1 [1] / [1] [1] [1] [1] [1]

    Adjacent shapes, on 2,000 vertices (p 0 to 49, q 0 to 39) with the index on (p, q): the prefix equality, the map form, IN, the full key with a parameter and with a null parameter, the second column alone, a range on the second column and an OR give the expected counts after the fix (0 of 36 wrong across the four type kinds, nine queries each, against 12 of 36 wrong before; all the wrong ones are the exception, on the two hash indexes).

    query (2,000 vertices, p 0..49, q 0..39, index on (p, q)) expected rows Hash before Hash after UniqueHash before UniqueHash after
    n.p = 7 40 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok
    {p: 7} 40 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok
    n.p IN [1, 2] 80 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok
    n.p = 7 AND n.q = 3 1 ok ok ok ok
    n.p = $p AND n.q = $q ($p 7, $q 3) 1 ok ok ok ok
    n.p = $p AND n.q = $q ($p 7, $q null) 0 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok
    n.q = 3 (second column only) 50 ok ok ok ok
    n.p = 7 AND n.q > 35 4 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok
    n.p = 7 OR n.p = 8 80 WRONG UnsupportedOperationException ok WRONG UnsupportedOperationException ok

    The fix keeps the hash index for the full key: the plan of MATCH (n:T) WHERE n.p = 7 AND n.q = 3 starts with NodeIndexSeek on the hash index after the fix on both JDKs, as it did before.

    Thanks for the quick fix.

  11. oc007us
    added a commit that references this issue on Oct 5, 2026

    fix(ArcadeData#9245,ArcadeData#9241,ArcadeData#9236,ArcadeData#9237,A…

    e981bb1
  12. tae898
    added a commit that references this issue on Oct 5, 2026

    bindings: known issues and strict xfail tripwires for upstream Arcade…

    cde639b
  13. robfrank
    added a commit that references this issue on Oct 6, 2026

    fix(#9245,#9241,#9236,#9237,#9240): DML positional plan key, vector s…

    9925c7d
  14. lvca
    added a commit that references this issue on Nov 24, 2026

    fix(#12677): a native select range on a HASH-indexed property is answ…

    c8d486a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

bugengineCore engine: document/schema APIopencypherseverity:minorCosmetic, documentation, edge case, or a workaround exists

Type

No type

Projects

No projects

    Milestone

    • 26.10.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.