Skip to content

[WIP] Arango Compatibility - #343

Open
kellrott wants to merge 20 commits into
developfrom
feature/arango
Open

[WIP] Arango Compatibility#343
kellrott wants to merge 20 commits into
developfrom
feature/arango

Conversation

@kellrott

Copy link
Copy Markdown
Member
  • Basic graph driver support : Support basic operations
  • Index mangagement
  • Support for native Arango Graphs? Determine if support of discovery and reflection of existing Arango graphs (vs those that GRIP creates) is supportable, or if there are unaccounted edge cases
  • Transpiler based traversal support. Rather then doing individual operations, translate GripQL query into Arango query and have all work done remotely
  • Benchmarking and overhead analysis

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR is a WIP effort to add ArangoDB compatibility to GRIP, including a new Arango driver scaffold, a first-pass GripQL→AQL transpiler, and CI/conformance/benchmarking plumbing to exercise the new backend.

Changes:

  • Add an arango backend (config wiring, server driver selection, Arango GraphDB/Graph implementations, and a transpiler-based compiler path).
  • Add Arango conformance harness support (test config, Makefile docker helpers, CI job, and conformance runner improvements).
  • Add/refresh benchmarking utilities and client bulk helpers to support performance evaluation.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/main_test.go Adds Arango driver option to the test harness DB initialization.
test/arango.yml New test config for running GRIP against ArangoDB locally.
server/server.go Enables StartDriver to construct an Arango-backed GraphDB.
Makefile Adds start-arango / stop-arango docker targets and readiness wait loop.
gripql/client.go Adds AddVertexArray / AddEdgeArray bulk helpers using BulkAdd.
go.mod Adds Arango driver dependency, bumps Go version, updates several deps.
go.sum Dependency lock updates for Arango + other module bumps.
docs/planning/gripql_to_aql.md Large planning/spec doc for GripQL→AQL transpilation approach.
conformance/run_util.py Adds optional YAML report output for conformance runs.
conformance/requirements.txt Declares Python deps for conformance (pyyaml, requests).
conformance/conformance.sh New all-in-one conformance runner for multiple backends.
config/config.go Wires ArangoDB config into driver config, defaults, and redaction.
cmd/server/main.go Adds CLI default-driver selection support for arango.
benchmark/run_benchmarks.sh New benchmark runner script that spins up backends and runs CLI benchmarks.
benchmark/graphbench/methods.go Adds random data/insert/query helpers (used by benchmarks).
benchmark/graphbench/interface.go Defines benchmark result types and function signatures.
benchmark/graphbench/benchmarks.go Adds concrete benchmark implementations (bulk insert, traversal, vector read/write).
benchmark/graphbench-cli/main.go Adds a CLI for running benchmarks against a GRIP server and writing JSON results.
benchmark/graph-bench/main.go Removes older benchmark program.
benchmark/engine_test.go Adjusts benchmark setup to ensure the graph exists before use.
arango/translate.go Implements GripQL statement→AQL translation into an AST.
arango/translate_test.go Adds tests asserting the generated AQL for supported statement subsets.
arango/processor.go Executes transpiled AQL and converts results into GRIP travelers (marks/path support).
arango/graphdb.go Implements Arango GraphDB scaffold (connect, create/list graphs, graph handles).
arango/graph.go Implements Arango graph operations (CRUD, traversal helpers, index management, scans).
arango/compiler.go Adds transpiler compiler that falls back to core compiler for unsupported steps.
arango/ast.go Adds AST types and stringification for AQL generation.
arango/ast_test.go Adds AST stringification tests.
.github/workflows/tests.yml Adds an Arango conformance CI job.
.github/skills/conformance-test/SKILL.md Documents conformance workflow usage.
Suppressed comments (1)

benchmark/graphbench/benchmarks.go:110

  • len(res) is being called on a result channel returned by Traversal. len(chan) only reports the current buffered items, not the total results, and the benchmark also stops timing before draining the stream. This makes the reported count/time incorrect.
	if err != nil {
		log.Fatalf("LargeVector read error: %v", err)
	}
	readResults.Time = time.Since(readStart).Seconds()
	fmt.Printf("Large vector query result count: %d\n", len(res))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread arango/translate.go
Comment on lines +257 to +272
case *gripql.GraphStatement_Sort:
fields := make([]string, 0, len(stmt.Sort.GetFields()))
for _, field := range stmt.Sort.GetFields() {
if field != nil {
expr := field.Field
if field.Descending {
expr += " DESC"
} else {
expr += " ASC"
}
fields = append(fields, expr)
}
}
if len(fields) > 0 {
currentLoop.Body.Children = append(currentLoop.Body.Children, &SortStatement{Expr: strings.Join(fields, ", ")})
}
Comment on lines +93 to +101
func RandomVertexInsert(kgraph gripql.Client, graph string) {
for i := 0; i < 10000; i++ {
d := []*gripql.Vertex{}
for j := 0; j < 20; j++ {
d = append(d, RandomVertex())
}
kgraph.AddVertexArray(graph, d)
}
}
Comment on lines +103 to +110
func RandomOneToManyInsert(kgraph gripql.Client, graph string) {
for i := 0; i < 50000; i++ {
v, oe, ov := RandOneToMany(3)
kgraph.AddVertex(graph, v)
kgraph.AddVertexArray(graph, ov)
kgraph.AddEdgeArray(graph, oe)
}
}
Comment on lines +63 to +73
func Benchmark_QueryKnowsCount(ctx context.Context, c *gripql.Client, graph string) []Result {
result := Result{Name: "QueryKnowsCount", Scale: 10000, Meta: map[string]any{}}
query := gripql.V().HasLabel("Person").Out("knows").Count()
res, err := c.Traversal(ctx, &gripql.GraphQuery{Graph: graph, Query: query.Statements})
if err != nil {
log.Fatalf("Query error: %v", err)
result.Error = err
}
fmt.Printf("Knows count result: %+v\n", res)
return []Result{result}
}
Comment thread arango/compiler.go
Comment thread .github/workflows/tests.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.

Suppressed comments (4)

gripql/client.go:234

  • Same stream-cleanup issue as AddVertexArray: ensure the stream is closed on early send failures.
	for _, elem := range e {
		err := sc.Send(&GraphElement{Graph: graph, Edge: elem})
		if err != nil {
			return err
		}

benchmark/engine_test.go:23

  • This existence check is brittle and likely won’t match the actual error returned by AddGraph for KVGraph (e.g., index setup failures). Prefer checking whether the graph exists before trying to add it.
	gd := kvgraph.NewKVGraph(kv)
	if err := gd.AddGraph("test-graph"); err != nil && err.Error() != "graph already exists" {
		b.Fatal(err)
	}
	db, err := gd.Graph("test-graph")

gripql/client.go:220

  • On a streaming send error, the client stream should be closed to avoid leaking resources. CloseAndRecv() closes the stream only on the happy path; add a best-effort CloseSend() before returning.

This issue also appears on line 230 of the same file.

	for _, elem := range v {
		err := sc.Send(&GraphElement{Graph: graph, Vertex: elem})
		if err != nil {
			return err
		}

arango/graph.go:270

  • AddVertexIndex(label, field) is label-scoped in other drivers (e.g., Mongo uses a compound index on _label + field with a label filter). Creating an index only on field can lead to duplicated identical indexes across labels and poorer query selectivity. Consider including _label as the leading indexed field to better match expected semantics.
func (g *Graph) AddVertexIndex(label string, field string) error {
	_, _, err := g.vertexCol.EnsurePersistentIndex(
		context.Background(),
		[]string{field},
		&arangodb.CreatePersistentIndexOptions{Name: vertexIndexName(label, field)},
	)
	if err != nil {

Comment thread test/main_test.go
Comment on lines +162 to +166
} else if dbconfig.ArangoDB != nil {
gdb, err = arango.NewGraphDB(*dbconfig.ArangoDB)
if err != nil {
fmt.Printf("Init error: %s\n", err)
}
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.

3 participants