test: cover new decode/validity branches; fix S3034 dict bit-set masking (Sonar gate)#228
Merged
Merged
Conversation
…ing (Sonar gate) Fix the two java:S3034 findings (byte promoted to int before OR without masking) that gate-block new_reliability_rating; both are behavior-preserving (result is immediately re-cast to byte): - reader/decode/DictEncodingDecoder.java setBit (~L207) - reader/layout/DictLayoutDecoder.java validity-mask gather (~L200) Add coverage for the previously untested decode/validity branches these paths introduced: - B1: RleEncodingDecoder F32/F64 decode (run boundary, empty->constant array) and the readDoubles/readFloats broadcast helpers (new RleEncodingDecoderTest; helpers made package-private, unreachable via decode() as constant children fully materialize). - B6: LazyRleFloatArray.materialize constant-run + empty-chunk fast path (mirrors the double sibling). - B2: DictEncodingDecoder validity broadcast slow path (codesCap < rowCount, the setBit fix site) plus U16/U32 readCode widths with combined codes/pool nulls. - B3: DictLayoutDecoder byte/short dict pools (DictByteArray/DictShortArray) and the gatherRowValidity Short/Int/Long codes-type arms. - B4: ScanIterator merged-grid out-of-range guard (mismatched column totals) and the sliceArray StructArray branch via a hand-assembled nested-struct file (also drives collectFlats' struct arm). - B5: ZonedStatsSchema boolean/size stat arms, fixed-width (I64/I32) field skip, the >63-bit varint overflow, and inner-spec overflow-tag / unknown-wire-type bail-outs. Not reached (reported, not forced): the readCode/gatherRowValidity `default` throws are pre-empted upstream (the expand switch and DictArrays.validateCodes reject non-U8/U16/U32 codes before those arms run) — defensive dead code, left as-is rather than backed by an unkillable test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Turns the SonarCloud quality gate green and covers the highest-risk uncovered branches from this session's fixes (identified by a SonarCloud analysis run).
Gate fix — the gate was red solely on
new_reliability_rating = C, from twojava:S3034findings (abytesign-extends tointbefore an OR in the dict validity bit-setter). Functionally no-ops — the result is immediately re-cast to(byte)— but they gate-block. Masked with& 0xffat both sites (DictEncodingDecoder.setBit,DictLayoutDecodervalidity gather). No behavior change, no CHANGELOG entry.Coverage (+21 tests, all reader green at 1179) — the untested silent-corruption branches this session touched:
RleEncodingDecoderTest, 7): decode across a run boundary, empty→constant, and thereadDoubles/readFloatsbroadcast helpers; plusLazyRleFloatArrayconstant/empty-chunk parity with its double sibling.codesCap < rowCounti % capvalidity loop (the S3034 fix site) with U16/U32 code widths and combined codes+pool nulls.DictByteArray/DictShortArraypools and thegatherRowValiditycodes-type arms.VortexExceptionguard, and a hand-assembled nested-struct file driving theStructArrayslice arm.Two
default-throw arms in the dict decoders are left untested by design — they're pre-empted upstream (DictArrays.validateCodes/ the expand switch reject non-U8/U16/U32 codes first), so they're defensive dead code; per simplify-first, no unkillable test.🤖 Generated with Claude Code