Skip to content

[gremlin-dotnet] Handle non-bulked results in remote traversals#3525

Open
xiazcy wants to merge 2 commits into
masterfrom
dotnet-bulk-fix
Open

[gremlin-dotnet] Handle non-bulked results in remote traversals#3525
xiazcy wants to merge 2 commits into
masterfrom
dotnet-bulk-fix

Conversation

@xiazcy

@xiazcy xiazcy commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The gremlin-dotnet remote traversal path (DriverRemoteConnection / TransactionRemoteConnection) assumed every server result was a Traverser. It submitted as SubmitAsync<Traverser>, so ResultSet<Traverser> performed an unconditional (Traverser)item cast during iteration.

When a compatible HTTP endpoint returns non-bulked results, e.g. a raw Int64 for g.V().count(), or any traversal run with bulkResults=false, the values arrive as raw scalars rather than Traverser instances, and the cast throws InvalidCastException. In effect, bulkResults=false was unusable on the remote traversal path.

Fix

Submit as SubmitAsync<object> and adapt the stream at the iteration boundary: pass Traverser instances through unchanged, and wrap raw values in new Traverser(item, 1). This mirrors the other GLVs. The generic ResultSet<T> and the plain client.SubmitAsync<T> path are unchanged.

Testing

  • Unit tests for the adaptation: raw scalar, bulked Traverser expansion, and a mixed stream (DriverRemoteConnectionTests).
  • Remote-traversal integration tests with bulkResults=false for a single scalar (count) and multi-result (values) case (GraphTraversalTests).
  • Client-path integration tests confirming bulkResults true/false behavior (GremlinClientTests), matching the Go driver's coverage.

VOTE +1

xiazcy added 2 commits July 17, 2026 14:58
Remote traversals assumed every result was a Traverser and threw
InvalidCastException on non-bulked scalar responses (bulkResults=false).
Wrap raw values in a Traverser at the iteration boundary, matching the
Java, Python, Go, and JavaScript drivers.

Assisted-by: Kiro:claude-opus-4-8
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