Skip to content

Commit 7516a54

Browse files
dfa1claude
andcommitted
refactor(decode): drop unused accepts(DType) from EncodingDecoder SPI
accepts(DType) was a residual of the ADR-0001 read/write runtime split: the pre-split unified Encoding interface combined encode + accepts + decode, and the split copied the full method set onto both EncodingDecoder and EncodingEncoder. accepts is encode-selection semantics ("can this encoding *encode* the dtype") — the writer's CascadingCompressor and friends still use EncodingEncoder.accepts, but the reader dispatches decoders purely by EncodingId (ReadRegistry's Map<EncodingId, EncodingDecoder>) and never calls it. The method has been dead on the read side since the split; SonarCloud flagged it as uncovered on BitpackedEncodingDecoder. Remove accepts from the EncodingDecoder interface and all 33 implementations, plus the decoder-side accepts assertions in the unit tests (the writer encoder.accepts assertions stay). Added a DictEncodingDecoderTest#encodingId test to keep that outer class from collapsing to a checkstyle utility class once its only non-nested test was removed. EncodingEncoder.accepts is unchanged. Verified: full unit suite (all modules) green; reader/writer build clean (javac -Werror, checkstyle, javadoc). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8999661 commit 7516a54

42 files changed

Lines changed: 3 additions & 265 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

reader/src/main/java/io/github/dfa1/vortex/reader/decode/AlpEncodingDecoder.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ public EncodingId encodingId() {
3838
return EncodingId.VORTEX_ALP;
3939
}
4040

41-
@Override
42-
public boolean accepts(DType dtype) {
43-
if (!(dtype instanceof DType.Primitive p)) {
44-
return false;
45-
}
46-
return p.ptype() == PType.F64 || p.ptype() == PType.F32;
47-
}
48-
4941
@Override
5042
public Array decode(DecodeContext ctx) {
5143
ByteBuffer rawMeta = ctx.metadata();

reader/src/main/java/io/github/dfa1/vortex/reader/decode/AlpRdEncodingDecoder.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ public EncodingId encodingId() {
3434
return EncodingId.VORTEX_ALPRD;
3535
}
3636

37-
@Override
38-
public boolean accepts(DType dtype) {
39-
if (!(dtype instanceof DType.Primitive p)) {
40-
return false;
41-
}
42-
return p.ptype() == PType.F32 || p.ptype() == PType.F64;
43-
}
44-
4537
@Override
4638
public Array decode(DecodeContext ctx) {
4739
ALPRDMetadata meta = parseMeta(ctx);

reader/src/main/java/io/github/dfa1/vortex/reader/decode/BitpackedEncodingDecoder.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ public EncodingId encodingId() {
3131
return EncodingId.FASTLANES_BITPACKED;
3232
}
3333

34-
@Override
35-
public boolean accepts(DType dtype) {
36-
if (!(dtype instanceof DType.Primitive p)) {
37-
return false;
38-
}
39-
return switch (p.ptype()) {
40-
case I8, I16, I32, I64, U8, U16, U32, U64 -> true;
41-
default -> false;
42-
};
43-
}
44-
4534
@Override
4635
public Array decode(DecodeContext ctx) {
4736
ByteBuffer rawMeta = ctx.metadata();

reader/src/main/java/io/github/dfa1/vortex/reader/decode/BoolEncodingDecoder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.dfa1.vortex.reader.decode;
22

3-
import io.github.dfa1.vortex.core.DType;
43
import io.github.dfa1.vortex.encoding.EncodingId;
54
import io.github.dfa1.vortex.reader.array.Array;
65
import io.github.dfa1.vortex.reader.array.MaterializedBoolArray;
@@ -19,11 +18,6 @@ public EncodingId encodingId() {
1918
return EncodingId.VORTEX_BOOL;
2019
}
2120

22-
@Override
23-
public boolean accepts(DType dtype) {
24-
return dtype instanceof DType.Bool;
25-
}
26-
2721
@Override
2822
public Array decode(DecodeContext ctx) {
2923
return new MaterializedBoolArray(ctx.dtype(), ctx.rowCount(), ctx.buffer(0));

reader/src/main/java/io/github/dfa1/vortex/reader/decode/ByteBoolEncodingDecoder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.dfa1.vortex.reader.decode;
22

3-
import io.github.dfa1.vortex.core.DType;
43
import io.github.dfa1.vortex.encoding.EncodingId;
54
import io.github.dfa1.vortex.reader.array.Array;
65
import io.github.dfa1.vortex.reader.array.MaterializedBoolArray;
@@ -21,11 +20,6 @@ public EncodingId encodingId() {
2120
return EncodingId.VORTEX_BYTEBOOL;
2221
}
2322

24-
@Override
25-
public boolean accepts(DType dtype) {
26-
return dtype instanceof DType.Bool;
27-
}
28-
2923
@Override
3024
public Array decode(DecodeContext ctx) {
3125
long n = ctx.rowCount();

reader/src/main/java/io/github/dfa1/vortex/reader/decode/ChunkedEncodingDecoder.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ public EncodingId encodingId() {
3535
return EncodingId.VORTEX_CHUNKED;
3636
}
3737

38-
@Override
39-
public boolean accepts(DType dtype) {
40-
return dtype instanceof DType.Primitive
41-
|| dtype instanceof DType.Bool
42-
|| dtype instanceof DType.Struct;
43-
}
44-
4538
@Override
4639
public Array decode(DecodeContext ctx) {
4740
int nchildren = ctx.node().children().length;

reader/src/main/java/io/github/dfa1/vortex/reader/decode/ConstantEncodingDecoder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public EncodingId encodingId() {
3535
return EncodingId.VORTEX_CONSTANT;
3636
}
3737

38-
@Override
39-
public boolean accepts(DType dtype) {
40-
return dtype instanceof DType.Primitive;
41-
}
42-
4338
@Override
4439
public Array decode(DecodeContext ctx) {
4540
MemorySegment scalarBuf = ctx.buffer(0);

reader/src/main/java/io/github/dfa1/vortex/reader/decode/DateTimePartsEncodingDecoder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ public EncodingId encodingId() {
3333
return EncodingId.VORTEX_DATETIMEPARTS;
3434
}
3535

36-
@Override
37-
public boolean accepts(DType dtype) {
38-
return dtype instanceof DType.Extension;
39-
}
40-
4136
@Override
4237
public Array decode(DecodeContext ctx) {
4338
ByteBuffer meta = ctx.metadata();

reader/src/main/java/io/github/dfa1/vortex/reader/decode/DecimalBytePartsEncodingDecoder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ public EncodingId encodingId() {
2424
return EncodingId.VORTEX_DECIMAL_BYTE_PARTS;
2525
}
2626

27-
@Override
28-
public boolean accepts(DType dtype) {
29-
return dtype instanceof DType.Decimal;
30-
}
31-
3227
@Override
3328
public Array decode(DecodeContext ctx) {
3429
ByteBuffer meta = ctx.metadata();

reader/src/main/java/io/github/dfa1/vortex/reader/decode/DecimalEncodingDecoder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.dfa1.vortex.reader.decode;
22

3-
import io.github.dfa1.vortex.core.DType;
43
import io.github.dfa1.vortex.core.VortexException;
54
import io.github.dfa1.vortex.reader.array.Array;
65
import io.github.dfa1.vortex.reader.array.LazyDecimalArray;
@@ -23,11 +22,6 @@ public EncodingId encodingId() {
2322
return EncodingId.VORTEX_DECIMAL;
2423
}
2524

26-
@Override
27-
public boolean accepts(DType dtype) {
28-
return dtype instanceof DType.Decimal;
29-
}
30-
3125
@Override
3226
public Array decode(DecodeContext ctx) {
3327
ByteBuffer meta = ctx.metadata();

0 commit comments

Comments
 (0)