Skip to content

Remove dead code and duplicated helpers - #591

Merged
dfa1 merged 1 commit into
mainfrom
chore/remove-dead-code
Oct 22, 2026
Merged

dfa1 merged 1 commit into
mainfrom
chore/remove-dead-code

Conversation

@dfa1

@dfa1 dfa1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Cleanup from an audit for dead and duplicated code (method-level reference counts plus PMD CPD). No behavior change.

Dead or test-only code

  • ZonedStatsSchema.zoneLength(MemorySegment): no caller. The scan finds legacy vortex.stats zones by physical chunk (ScanIterator#zoneStarts). Its 3 tests go with it.
  • TimestampExtensionDecoder.zonedDateTime: only tests called it. It was instant(...).atZone(timezone(ext).orElse(UTC)) over two public methods. timezone() already has its own tests.
  • StatsOptions.distinctAndTop(): only tests called it. The 3 writer tests now keep a local ALL_STATS built with the withXxx methods.
  • LeBitReader.bitsConsumed() (package-private class): only tests called it. Those tests now check the position by reading the next bits.
  • Ansi.CLEAR_LINE_RIGHT: never referenced.

Duplicated code

  • reader: SparseEncodingDecoder.scalarToLong was a copy of ConstantEncodingDecoder.scalarToRawBits. Sparse now calls the Constant one.
  • writer: ChunkImpl.adaptUtf8/adaptBinary now share adaptVarBin for the null check and validity bitmap.
  • cli: InspectorRender reuses GridRender.formatPrimitive and bytesToHex instead of its own copies. Strings, bytes and decimals still render the way each view did before.
  • csv: jsonValue drops its three copied list cases. It already fell back to cellValue, which renders lists the same way. A new List[List[I64]] test covers this path, which no test reached before.

Left as is: the per-type copies in BitpackedEncodingDecoder and the FSST fast/tail loops are deliberate hot-loop specialization.

Testing: ./mvnw verify -pl reader,writer,cli,csv -am -DskipITs passes (unit tests and javadoc). No interop cross-check test added: nothing read or written changes.

🤖 Generated with Claude Code

@dfa1
dfa1 force-pushed the chore/remove-dead-code branch from bd0aed4 to e541ed0 Compare October 22, 2026 20:19
@dfa1 dfa1 changed the title Remove dead code and one duplicated helper Remove dead code and duplicated helpers Oct 22, 2026
Found by method-level reference counts plus PMD CPD. No behavior change.

Dead or test-only code:
- ZonedStatsSchema.zoneLength: no caller; the scan finds legacy vortex.stats
  zones by physical chunk (ScanIterator#zoneStarts).
- TimestampExtensionDecoder.zonedDateTime: only tests called it; it was just
  instant(...).atZone(timezone(ext).orElse(UTC)).
- StatsOptions.distinctAndTop: only tests called it; they now keep a local
  ALL_STATS built with the withXxx methods.
- LeBitReader.bitsConsumed: only tests called it; they now check the position
  by reading the next bits.
- Ansi.CLEAR_LINE_RIGHT: never referenced.

Duplicated code:
- SparseEncodingDecoder.scalarToLong copied ConstantEncodingDecoder.scalarToRawBits.
- ChunkImpl.adaptUtf8/adaptBinary now share adaptVarBin.
- InspectorRender reuses GridRender.formatPrimitive and bytesToHex.
- CsvExporter.jsonValue drops its copied list cases and falls back to cellValue;
  a new List[List[I64]] test covers this path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 force-pushed the chore/remove-dead-code branch from 5ba5ffa to 3f683b8 Compare October 22, 2026 20:25
@dfa1
dfa1 merged commit f34b8e0 into main Oct 22, 2026
6 checks passed
@dfa1
dfa1 deleted the chore/remove-dead-code branch October 22, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant