Skip to content

Fix missing type casting in AGG group qualifier encoding - #388

Merged
em3s merged 2 commits into
mainfrom
fix/agg-group-predicate-cast
Jul 2, 2026
Merged

em3s merged 2 commits into
mainfrom
fix/agg-group-predicate-cast

Conversation

@zipdoki

@zipdoki zipdoki commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes AGG queries returning count=0 on group fields whose property type is not String. The write path encoded the qualifier with the native type (e.g. Long 1L → encodeInt64), but the read path passed the predicate value through as a String, so qualifier bytes never matched.

The fix casts bucketless predicate values to the schema property type before qualifier encoding, on both the leading-fields path (eqValues) and the trailing-field path (encodeAggRanges). Bucketed fields are unchanged — the bucket already normalises the value.

Closes #227

Changes

  • Cast group predicate values to the schema property type when the field is bucketless (V2BackedTableBinding.agg / encodeAggRanges).
  • Add integration spec EdgeAggQuerySpec covering Long Eq, Long Between, String Eq, multi-field, and Date-bucketed group queries.
  • Add interactive e2e script bin/e2e_agg_group_predicate_cast.sh for manual verification against a running server.

How to Test

  • ./gradlew :engine:test --tests 'com.kakao.actionbase.v2.engine.v3.EdgeAggQuerySpec' — 5/5 pass; without the fix Long Eq / Long Between / multi-field fail with count=0.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code (Sonnet 4.6 / Opus 4.7, 1M context)

@zipdoki zipdoki self-assigned this Jul 2, 2026
@zipdoki
zipdoki requested a review from em3s as a code owner July 2, 2026 01:09
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 2, 2026
@zipdoki
zipdoki removed the request for review from em3s July 2, 2026 01:11
@em3s

em3s commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@zipdoki

Consider adding val propertiesByName = properties.associateBy { it.name } to ModelSchema - removes the duplicated find.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 2, 2026
@zipdoki

zipdoki commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@em3s
Done — added propertiesByName on ModelSchema (lazy associateBy) and switched both call sites to it. Same pattern as StructType.nameToField.

@em3s

em3s commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

LGTM @zipdoki

Merging

@em3s
em3s merged commit 77f83e9 into main Jul 2, 2026
2 checks passed
@em3s
em3s deleted the fix/agg-group-predicate-cast branch July 2, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing type casting in AGG group qualifier encoding

2 participants