Skip to content

Add MultiEdge count API backed by agg group#382

Open
zipdoki wants to merge 3 commits into
mainfrom
feat/multi-edge-count-by-agg
Open

Add MultiEdge count API backed by agg group#382
zipdoki wants to merge 3 commits into
mainfrom
feat/multi-edge-count-by-agg

Conversation

@zipdoki

@zipdoki zipdoki commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a /multi-edges/count endpoint that returns the count of multi-edges for a given (source, target) pair, backed by the existing agg group mechanism.

The counter field (_target for OUT, _source for IN) is automatically prepended to ranges, so callers only need to provide start, target, and direction. Additional ranges (e.g. time bucket) can be appended for period-based counts.

Requires the table schema to declare a COUNT group with _target (or _source) as the leading field.

Endpoint

/graph/v3/databases/{database}/tables/{table}/multi-edges/count\
?start={start}&target={target}&direction={direction}&group={group}&ranges={ranges}

Response

{
  "counts": [
    {
      "start": "userA",
      "direction": "OUT",
      "count": 2,
      "context": {}
    }
  ],
  "count": 1,
  "context": {}
}
  1. total count (group defaults to _count)
curl -X GET "http://localhost:8080/graph/v3/databases/{database}/tables/{table}/multi-edges/count\
?start=userA&target=postB&direction=OUT"
  1. period-based count
curl -X GET "http://localhost:8080/graph/v3/databases/{database}/tables/{table}/multi-edges/count\
?start=userA&target=postB&direction=OUT&group=day&ranges=time:bt:20240601,20240630"

Changes

  • QueryService.multiEdgeCount: builds fullRanges from target + optional ranges and delegates to agg
  • MultiEdgeQueryController: exposes GET /multi-edges/count
  • MultiEdgeAggCountPayload, DataFrameMultiEdgeAggCountPayload: response payload types
  • MultiEdgeCountE2ETest: E2E tests for total count and period-based count
  • EdgeMutationBuilder: add MULTI_EDGE_COUNT_GROUP_NAME constant as the default group name for (source, target) count

How to Test

./gradlew :server:test --tests "com.kakao.actionbase.server.api.graph.v3.MultiEdgeCountE2ETest"

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Sonnet 4.6 (claude.ai/code)

@zipdoki zipdoki self-assigned this Jun 14, 2026
@zipdoki zipdoki requested a review from em3s as a code owner June 14, 2026 15:53
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 14, 2026
@zipdoki zipdoki removed the request for review from em3s June 14, 2026 15:53
@dosubot dosubot Bot added the enhancement New feature or request label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant