Skip to content

fix: add support for LSM sparse vector type in BoltNetworkExecutor#4079

Merged
robfrank merged 2 commits into
mainfrom
fix/support-sparse-lsm
May 5, 2026
Merged

fix: add support for LSM sparse vector type in BoltNetworkExecutor#4079
robfrank merged 2 commits into
mainfrom
fix/support-sparse-lsm

Conversation

@robfrank
Copy link
Copy Markdown
Collaborator

@robfrank robfrank commented May 5, 2026

What does this PR do?

fix bolt executor adding map for sparse vector

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

@robfrank robfrank requested a review from lvca May 5, 2026 08:19
@robfrank robfrank added this to the 26.5.1 milestone May 5, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 5, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage 66.67% diff coverage

Metric Results
Coverage variation Report missing for 95c57ba1
Diff coverage 66.67% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (95c57ba) Report Missing Report Missing Report Missing
Head commit (0c92cc4) 152973 100173 65.48%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4079) 6 4 66.67%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@claude
Copy link
Copy Markdown

claude Bot commented May 5, 2026

Code Review

Overview

This PR adds LSM_SPARSE_VECTOR support to the Bolt protocol executor by mapping the new index type to Neo4j-compatible strings (SPARSE_VECTOR, provider sparse-vector-2.0) and adding a filter for SHOW SPARSE_VECTOR INDEXES. The fix is clearly needed since the INDEX_TYPE enum already has LSM_SPARSE_VECTOR but the bolt layer had no mapping for it (which would cause a compile error on exhaustive switch expressions or a missing case at runtime).


Bug: Routing condition is incomplete

File: bolt/src/main/java/com/arcadedb/bolt/BoltNetworkExecutor.java, around line 1079

The handleSyntheticQuery method routes SHOW ... INDEXES commands to buildShowIndexesResults via this block:

} else if (normalized.startsWith("show index")
    || normalized.startsWith("show all index")
    || normalized.startsWith("show range index")
    || normalized.startsWith("show text index")
    || normalized.startsWith("show point index")
    || normalized.startsWith("show lookup index")
    || normalized.startsWith("show fulltext index")
    || normalized.startsWith("show vector index")) {

show sparse_vector index is missing from this condition. A Neo4j client issuing SHOW SPARSE_VECTOR INDEXES (normalized to show sparse_vector indexes) will not hit this branch at all, so buildShowIndexesResults is never called and the indexTypeMatchesFilter code added in this PR is dead code for that path.

Fix:

} else if (normalized.startsWith("show index")
    || normalized.startsWith("show all index")
    || normalized.startsWith("show range index")
    || normalized.startsWith("show text index")
    || normalized.startsWith("show point index")
    || normalized.startsWith("show lookup index")
    || normalized.startsWith("show fulltext index")
    || normalized.startsWith("show vector index")
    || normalized.startsWith("show sparse_vector index")) {

Missing test coverage

The PR checklist says unit tests were written, but the diff contains no new test code. There is already a pattern to follow in BoltProtocolIT:

@Test
void showVectorIndexesReturnsEmptyWithoutVectorIndexes() { ... }

A parallel test for SHOW SPARSE_VECTOR INDEXES should be added:

@Test
void showSparseVectorIndexesReturnsEmptyWithoutSparseVectorIndexes() {
    try (Driver driver = getDriver()) {
        try (Session session = driver.session(SessionConfig.forDatabase(getDatabaseName()))) {
            final Result result = session.run("SHOW SPARSE_VECTOR INDEXES");
            assertThat(result.keys()).containsExactly("id", "name", "state", "populationPercent", "type",
                "entityType", "labelsOrTypes", "properties", "indexProvider", "owningConstraint", "lastRead", "readCount");
            final List<Record> rows = result.list();
            for (final Record r : rows)
                assertThat(r.get("type").asString()).isEqualTo("SPARSE_VECTOR");
        }
    }
}

Minor: Provider string convention

sparse-vector-2.0 is consistent with vector-2.0 and the naming pattern used elsewhere - no issue there.


Summary

Correctness Bug: show sparse_vector index missing from routing condition - the new indexTypeMatchesFilter branch is unreachable
The two switch-case additions (mapIndexTypeToNeo4j, mapIndexTypeToProvider) Correct
Test coverage Not provided despite checklist claim

The routing omission is a real functional gap - please add || normalized.startsWith("show sparse_vector index") to the routing block and add a regression test before merging.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the LSM_SPARSE_VECTOR index type within the BoltNetworkExecutor, including its mapping to Neo4j-compatible strings and provider versions. While the filtering logic for system queries was updated, feedback indicates that the handleSystemQuery method must also be modified to intercept the new SHOW SPARSE_VECTOR INDEXES command, otherwise the functionality remains unreachable.

Comment on lines +1300 to +1301
if (filter.startsWith("show sparse_vector index"))
return "SPARSE_VECTOR".equals(neoType);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The addition of LSM_SPARSE_VECTOR support in indexTypeMatchesFilter is correct, but for this to be reachable, the handleSystemQuery method (around line 1079) also needs to be updated to intercept the SHOW SPARSE_VECTOR INDEXES command. Currently, it only intercepts a specific set of 'show' commands, and sparse_vector is missing from that list. Without this interception, the command will not be recognized as a system query and will likely fail when passed to the query engine.

@claude
Copy link
Copy Markdown

claude Bot commented May 5, 2026

Code Review

Note: A prior automated review on this PR incorrectly flagged a missing routing condition and missing test. Both are present in the diff - this review corrects those findings.


Overview

This PR adds LSM_SPARSE_VECTOR index support to the Bolt network layer, maintaining parity with the existing LSM_VECTOR handling. The change covers all four places that needed updating:

  1. mapIndexTypeToNeo4j() - maps to "SPARSE_VECTOR"
  2. mapIndexTypeToProvider() - maps to "sparse-vector-2.0"
  3. handleSystemQuery() routing condition - adds "show sparse_vector index" to the if chain
  4. indexTypeMatchesFilter() - adds the filter predicate for sparse vector indexes

A regression test is included.


Correctness

The implementation is correct and complete. The exhaustive switch expressions now handle LSM_SPARSE_VECTOR without missing cases. The SHOW SPARSE_VECTOR INDEXES command routes correctly to buildShowIndexesResults and the filter predicate will correctly select only sparse vector indexes.


Test Coverage

The new test showSparseVectorIndexesReturnsEmptyWithoutSparseVectorIndexes mirrors the pattern of showVectorIndexesReturnsEmptyWithoutVectorIndexes. It verifies column names and that any returned rows have type == "SPARSE_VECTOR".

Suggestion: Consider adding a positive-path test that actually creates a sparse vector index and confirms it appears in SHOW SPARSE_VECTOR INDEXES and in SHOW ALL INDEXES. The empty-result case does not exercise indexTypeMatchesFilter in a meaningful way, so a bug there would go undetected.


Minor Observations

  • Import expansion (org.neo4j.driver.* -> individual imports): Good cleanup, consistent with project style.
  • Text block re-indentation in performHandshake(): Since the closing """ sits on the same line as content, Java strips the minimum indentation of all content lines uniformly, so the string value is unchanged. Safe cosmetic change.
  • Line wrapping (Prettier 160-char limit): All wrapped lines look correct.

Summary

The fix is correct and well-structured. The only real gap is the absence of a positive test case that exercises the filter path with an actual sparse vector index. Everything else LGTM.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.40%. Comparing base (25ed565) to head (0c92cc4).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...in/java/com/arcadedb/bolt/BoltNetworkExecutor.java 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4079      +/-   ##
==========================================
+ Coverage   64.36%   64.40%   +0.03%     
==========================================
  Files        1598     1603       +5     
  Lines      120818   121624     +806     
  Branches    25743    25940     +197     
==========================================
+ Hits        77766    78327     +561     
- Misses      32294    32452     +158     
- Partials    10758    10845      +87     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@robfrank robfrank merged commit 76f212a into main May 5, 2026
26 of 29 checks passed
@robfrank robfrank deleted the fix/support-sparse-lsm branch May 5, 2026 13:27
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.

2 participants