Add DELTA and DELTADELTA transform codecs - #19305
Open
xiangfu0 wants to merge 1 commit into
Open
Conversation
This was referenced Aug 19, 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.
Stacked on #19285 (
xiangfu0/codex/codec-stack/02-runtime). Part of the split of #18229.Summary
Adds the first two transform codecs to the package-private codec runtime in
org.apache.pinot.segment.local.io.codec:BaseDeltaCodecDefinition— shared structure for the delta family. Both codecs areCodecKind.TRANSFORMstages restricted toINT/LONGstored types, and both aretyped-layout-preserving (
preservesTypedValueLayout() == true): they mapcountcolumn-typed values to the same
countsame-width values with no per-frame header, so they canbe chained ahead of another transform (or each other) and
maxEncodedSizeis the identity.Two's-complement wrap-around on encode/decode is an intentional, test-locked contract:
overflow-adjacent sequences round-trip bit-for-bit through the wrapping
-/+arithmetic.DeltaCodecDefinition(DELTA) — first value verbatim, then successive deltas.DeltaDeltaCodecDefinition(DELTADELTA) — first value, first delta, then delta-of-deltas(good for near-regular timestamp intervals).
Both are registered in
CodecRegistry.DEFAULT, so specs likeDELTA,LZ4,DELTADELTA,ZSTD(3),and
DELTA,DELTADELTA,LZ4now parse, validate, and execute throughCodecPipelineExecutor.The names
DELTA/DELTADELTAare frozen on-disk contracts (stored verbatim in V7 segmentheaders by a later PR in the stack) and must never be renamed.
Tests
DeltaCodecRoundTripTest(new) — executor-driven round trips forDELTA,DELTADELTA,DELTA,LZ4,DELTADELTA,LZ4over INT and LONG datasets: empty, single-element, two-element(DELTADELTA boundary), constant, monotonic, negative/sign-changing, and overflow-adjacent
(
MIN_VALUEnext toMAX_VALUE) sequences; both the allocating decode path and the boundeddecode-into (segment-reader) path. Also a fail-closed corrupt-input case: a frame whose byte
length is not a whole number of elements is rejected on both encode and bounded decode.
CodecPipelineValidatorTest— real-transform scenarios againstCodecRegistry.DEFAULT:valid delta pipelines, typed-layout chaining (including
DELTA,DELTAand mixed order),transform-after-compression rejected, INT/LONG-only type check, argument rejection, and the
typed-value-layout contract assertions for both codecs.
CodecRegistryTest— DELTA/DELTADELTA now resolve fromDEFAULT(case-insensitive); theparent PR's absence assertion for unregistered codec names is left untouched.
CompressionCodecCorruptInputTest— the multi-stage inner-frame-guard test now usesDELTA,SNAPPY, tightening the scratch bound to exactly the four-byte declared chunk size.TableConfigUtilsTest— the codecSpec feature gate still rejects a well-formedDELTADELTA,LZ4config on a supported LONG column with"codecSpec is not supported yet for column: longCol", proving registration of the runtimecodecs did not open the config surface.
Deliberately excluded (carried by later PRs in the stack)
preservesTypedValueLayout() == false; until then the packing-placement rules remain coveredby the synthetic
PACKINGhandler inCodecPipelineValidatorTest.headers) — slice 05.
CodecPipelineExecutor.getCanonicalSpec()) — final slice.Why master stays safe with only this merged
The codec runtime remains package-private and unreachable from production paths: the only public
entry point is
CodecPipelineExecutor, and every config surface still throws"codecSpec is not supported yet for column: %s"(re-asserted in this PR'sTableConfigUtilsTestaddition). Registering DELTA/DELTADELTA in the closed registry adds dead-until-enabled code with
full unit coverage; no segment format, wire protocol, or config behavior changes.
Verification
Stack (split of #18229)
Each PR is based on its predecessor's branch; GitHub retargets the next PR as each merges.