Skip to content

Commit f89072a

Browse files
dfa1claude
andcommitted
refactor(writer): drop dead ptype arms in buildTypedUniqueArray
isDictCandidate excludes I8/U8/I16/U16/F16/F32, so only I32/U32, I64/U64, and F64 ever reach buildTypedUniqueArray. The narrow-int, F16, and F32 arms were unreachable dead code padding coverage. Collapse them into a default -> throw that documents the dict-admitted-ptype contract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c2918ea commit f89072a

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

writer/src/main/java/io/github/dfa1/vortex/writer/VortexWriter.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,24 +1353,11 @@ static PType codePTypeForSize(int dictSize) {
13531353
return PType.U32;
13541354
}
13551355

1356+
/// Builds the dictionary's unique-values array for a global-dict column. Only the carriers
1357+
/// [#isDictCandidate] admits — I32/U32, I64/U64, F64 — reach here; the narrow-int and F16/F32
1358+
/// ptypes are rejected as dict candidates upstream, so they are not handled.
13561359
private static Object buildTypedUniqueArray(PType ptype, java.util.Set<Object> keys, int size) {
13571360
return switch (ptype) {
1358-
case I8, U8 -> {
1359-
byte[] a = new byte[size];
1360-
int i = 0;
1361-
for (Object v : keys) {
1362-
a[i++] = (Byte) v;
1363-
}
1364-
yield a;
1365-
}
1366-
case I16, U16, F16 -> {
1367-
short[] a = new short[size];
1368-
int i = 0;
1369-
for (Object v : keys) {
1370-
a[i++] = (Short) v;
1371-
}
1372-
yield a;
1373-
}
13741361
case I32, U32 -> {
13751362
int[] a = new int[size];
13761363
int i = 0;
@@ -1387,14 +1374,6 @@ private static Object buildTypedUniqueArray(PType ptype, java.util.Set<Object> k
13871374
}
13881375
yield a;
13891376
}
1390-
case F32 -> {
1391-
float[] a = new float[size];
1392-
int i = 0;
1393-
for (Object v : keys) {
1394-
a[i++] = (Float) v;
1395-
}
1396-
yield a;
1397-
}
13981377
case F64 -> {
13991378
double[] a = new double[size];
14001379
int i = 0;
@@ -1403,6 +1382,7 @@ private static Object buildTypedUniqueArray(PType ptype, java.util.Set<Object> k
14031382
}
14041383
yield a;
14051384
}
1385+
default -> throw new IllegalStateException("ptype not admitted to the global dict: " + ptype);
14061386
};
14071387
}
14081388

0 commit comments

Comments
 (0)