Add topk aggregation metadata and list endpoint - #400
Open
zipdoki wants to merge 16 commits into
Open
Conversation
…edicates match writes
…metadata and expose `/graph/v3/aggregations` API
…traction for improved metadata handling.
Contributor
|
As we discussed offline about the
Could you rename these throughout the PR?
Also, since we decided the refresh table will be a single system-wide table, TopkTable no longer needs the expire field. |
# Conflicts: # engine/src/main/kotlin/com/kakao/actionbase/v2/engine/Graph.kt # engine/src/main/kotlin/com/kakao/actionbase/v2/engine/v3/V2BackedTableBinding.kt
… `supportedTypes`, and enhance `AggregationsListResponse` structure.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
zipdoki
commented
Jul 16, 2026
| }, ; | ||
|
|
||
| abstract fun has(aggregations: Aggregations): Boolean | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Might look like overkill for a single variant, but a second aggregation kind is planned in a follow-up. Keeping the extension surface to "one enum case + one matching field on Aggregations" — every consumer (isEmpty, supports, LabelEntity.hasAggregation, toQualifiedAggregations) routes through here and stays untouched when new kinds land.
Contributor
Author
zipdoki
added a commit
that referenced
this pull request
Jul 16, 2026
Follow-up on the terminology change from #400: the score row is still valid at the refresh timestamp, just due for a rebuild. Applied end-to- end so the aggregate flow and its persisted schema line up: - `AggregationConstants`: `TOPK_EXPIRE_TABLE` / `_PARTITIONS` and `expireSource` / `expireTarget` renamed - `AggregationService`: local `expiresAt` and property key `"expiresAt"` renamed - Refresh tracker table schema: column `expiresAt` → `refreshAt`, index `expires_at_asc` → `refresh_at_asc`, table comment updated Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…p-k-meta # Conflicts: # engine/src/main/kotlin/com/kakao/actionbase/v2/engine/Graph.kt # server/src/main/kotlin/com/kakao/actionbase/server/configuration/GraphConfiguration.kt
zipdoki
force-pushed
the
feature/per-entity-top-k-meta
branch
from
July 22, 2026 09:46
bcdb6f6 to
bd16d71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduce top-K aggregation metadata on
Groupand expose a read endpoint listing tables that declare one.A
Groupcan now carry anAggregationsblock. Today onlytopkis defined; the schema is designed so future aggregation kinds (e.g. HLL) can land as sibling fields without restructuring the payload.GET /graph/v3/aggregationsreturns a flat list of(type, database, table)tuples for every table that declares an aggregation, filterable by?type=. The aggregate/mutate flow that consumes this metadata is out of scope for this PR and will land separately.Metadata example
A group inside a label creation payload:
{ "groups": [ { "group": "purchased_count", "type": "COUNT", "fields": [{"name": "_target"}], "directionType": "OUT", "aggregations": { "topk": [ { "topk": "top_purchased", "entity": "_source", "ranges": "_target:eq:{_target}", "dimension": "_target", "refreshAfterMillis": 31536000000, "rank": "commerce.purchases__topk" } ] } } ] }Endpoint example
GET /graph/v3/aggregations{ "items": [ { "type": "TOPK", "database": "commerce", "table": "purchases" } ] }GET /graph/v3/aggregations?type=TOPKfilters to a single aggregation type.Test plan
./gradlew :core:test --tests 'com.kakao.actionbase.core.metadata.common.AggregationsTest'./gradlew :engine:test --tests 'com.kakao.actionbase.engine.service.AggregationServiceSpec'./gradlew :engine:test --tests 'com.kakao.actionbase.v2.engine.entity.LabelEntityFunctionsSpec'./gradlew :server:test --tests 'com.kakao.actionbase.server.api.graph.v3.metadata.MetadataAggControllerE2ETest'AI Assistance