Commit ea01579
refactor: FsstEncodingEncoder reuses PTypeIO.set instead of reimplementing it
The private writeUnsigned helper duplicated core.io.PTypeIO.set, the
canonical narrow-ptype write helper (MethodHandle-based, byte-offset
addressed, already used by every other encoder). Its default branch
throwing VortexException was dead: narrowestUnsigned only ever returns
U8/U16/U32, all of which PTypeIO.set handles with identical
little-endian layout and truncation-on-narrowing. Deleted writeUnsigned
and the now-unused VortexException import; the two call sites now pass
idx * ptype.byteSize() as the byte offset, matching the established
PTypeIO.set idiom.
Also close a round-trip coverage gap this refactor's own risk surface
exposed: every stringArrays() case kept uncompLenPType/codesOffPType in
the U8 tier, so the U16 length/offset write path was only checked via
metadata assertions, never a full decode. Add a 301-row u16-tier case
(one 300-byte row plus 300 single-char rows) that goes through
encode_thenDecode_roundtripsAllStrings, so the U16 buffer bytes are read
back and verified per row -- a wrong U16 stride now corrupts many rows
and fails the assertion. A metadata test pins that both ptypes escalate.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 7af2a78 commit ea01579
2 files changed
Lines changed: 64 additions & 22 deletions
File tree
- writer/src
- main/java/io/github/dfa1/vortex/writer/encode
- test/java/io/github/dfa1/vortex/writer/encode
Lines changed: 8 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | | - | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
| 130 | + | |
| 131 | + | |
130 | 132 | | |
131 | | - | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | | - | |
| 136 | + | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| |||
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | 157 | | |
171 | 158 | | |
172 | 159 | | |
| |||
Lines changed: 56 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
80 | 104 | | |
81 | 105 | | |
82 | 106 | | |
| |||
380 | 404 | | |
381 | 405 | | |
382 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
383 | 438 | | |
384 | 439 | | |
0 commit comments