Skip to content

Commit 23e277b

Browse files
dfa1claude
andcommitted
docs(claude): add pluggability design decisions for DType + Layout
DType: Extension is the intended escape hatch (mirrors Rust). No SPI for new variants needed or planned. Layout: fixed set (flat/chunked/zoned/struct/dict). Custom layouts require reader changes and no upstream use case exists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bb7fcb0 commit 23e277b

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

‎CLAUDE.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,36 @@ In every module `pom.xml`, dependencies are grouped with comments:
241241

242242
Omit a section if empty (e.g. integration module has no production deps; performance has no test deps).
243243

244+
## Pluggability decisions
245+
246+
### DType — already pluggable via Extension
247+
248+
`DType` is a sealed interface. The sealed variants (Primitive, Utf8, Struct, …) are
249+
file-format primitives; downstream consumers **must not** add new variants. Instead use
250+
`DType.Extension`:
251+
252+
```java
253+
// custom "ip.address" logical type over 4-byte I32 storage
254+
DType.Extension ipDtype = new DType.Extension("ip.address",
255+
new DType.Primitive(PType.I32, false), null, false);
256+
```
257+
258+
Register decoders via `ReadRegistry.builder().register(myDecoder)` and encoders via
259+
`ServiceLoader<ExtensionEncoder>` or `WriteRegistry.builder().register(myEncoder)`.
260+
This mirrors Rust exactly — `vortex.date`, `vortex.uuid`, etc. are all Extension types
261+
in Rust too. **No SPI for DType variants is planned.**
262+
263+
### Layout — fixed set, no SPI
264+
265+
`Layout` is a plain record with a `String encodingId`. `ScanIterator.decodeLayout()`
266+
dispatches on the four known IDs (flat/chunked/zoned/struct/dict) and throws for
267+
anything else. Custom layouts would require reader changes to traverse the tree,
268+
decode metadata, and handle child counts — no upstream Vortex format has shipped a
269+
custom layout that requires Java support.
270+
271+
Decision: **keep the fixed set**. Revisit only when a concrete downstream use case
272+
arrives that cannot be addressed by choosing a different encoding for a flat segment.
273+
244274
## API design
245275

246276
- Keep public interfaces as small as possible.

0 commit comments

Comments
 (0)