Repository navigation
Add ranges to the cache seek API - #304
Merged
Merged
Conversation
Mirrors EdgeBuffer.plusOne (codec-java) so Kotlin call sites that operate on ByteArrayBuffer/SimplePositionedMutableByteRange directly can construct exclusive boundary bytes for HBase ColumnRangeFilter without going through an EdgeBuffer wrapper. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Lets callers constrain a wide-row cache scan by leading-prefix predicates, mirroring the existing ranges parameter on scan (index). Predicates are translated to a single HBase ColumnRangeFilter start/stop; per-field Order is honoured by OrderedBytes (DESC fields are bit-inverted at write time), so a forward column scan over the resulting byte range yields the declared compound order without any scan-direction handling. Constraints, dictated by HBase wide-row physics, are enforced at the TableBinding boundary (matching scan): - predicates form a contiguous leading prefix of the cache's fields - only the trailing predicate may be a range; preceding predicates must be `=` - IN is rejected (would require disjoint byte ranges) Plumbed through QueryService.seek -> TableBinding.seek -> Label.cache -> HBaseIndexedLabel.cache. Range encoding is centralised in encodeCacheRange, which mirrors IndexedLabelMixin.createStartStop and reuses the same plusOne convention for inclusive/exclusive prefix bounds. The new QualifierStartStop / QualifierStartStopItem types are the cache-side analogue of IndexedLabelMixin.StartStop / StartStopItem; a follow-up can collapse the two once StartStopItem drops its field reference. Two small refactors fall out of the change: - hbaseGetWideRow no longer takes an Order. Bytes are byte-ordered upstream, so the previous from/to swap was a no-op. - IN predicates are explicitly rejected at the binding rather than failing deeper. Closes #303 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
zipdoki
commented
May 7, 2026
|
|
||
| fun ByteArrayBuffer.hasRemaining(): Boolean = remaining > 0 | ||
|
|
||
| fun ByteArrayBuffer.plusOne(): ByteArrayBuffer { |
Contributor
Author
There was a problem hiding this comment.
@em3s
Direct Kotlin port of EdgeBuffer.plusOne (codec-java); exposed as a ByteArrayBuffer extension so the cache prefix encoder doesn't need to wrap in an EdgeBuffer
em3s
removed their request for review
May 7, 2026 04:35
Contributor
|
Nice Work! @zipdoki Optimistic merging. As discussed offline, follow-up PR to:
|
Contributor
|
Close #303 |
This was referenced May 7, 2026
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
Adds a
rangesquery parameter to the cacheseekAPI. Predicates form a leading prefix of the cache's fields and translate to a single HBaseColumnRangeFilterover the qualifier bytes. Per-fieldOrderis honored byOrderedBytes(DESC fields are bit-inverted at write time), so the forward column scan yields the declared compound order with no scan-direction handling required.Closes #303
Changes
ranges: String?fromEdgeQueryControllerandActionbaseQuery.Item.SeekthroughQueryService.seek→TableBinding.seek→Label.cache→HBaseIndexedLabel.cache.V2BackedTableBinding.seek(matchingscan): leading-prefix order, trailing-only range, andINrejection.HBaseIndexedLabel.encodeCacheRangeto resolve predicates plus offset into one(from, to)byte range; offset, when present, supersedes the predicate-derivedfrom.QualifierStartStop/QualifierStartStopItemas the cache-side analogue ofIndexedLabelMixin.StartStop/StartStopItem(collapsible in a follow-up).orderparameter and thefrom/toswap fromhbaseGetWideRow; bytes are byte-ordered upstream, so the swap was a no-op.ByteArrayBuffer.plusOne(Kotlin port ofEdgeBuffer.plusOne) for exclusive boundary bytes on the cache encoder path.How to Test
./gradlew :core:test --tests "com.kakao.actionbase.core.edge.mapper.EdgeCacheRecordMapperTest"./gradlew :server:test --tests "com.kakao.actionbase.server.api.graph.v3.EdgeCacheQueryE2ETest"./gradlew spotlessCheckAI Assistance