Skip to content

Commit b750f60

Browse files
dfa1claude
andcommitted
docs: add Diátaxis reference doc; trim README; fix tutorial/how-to
Add docs/reference.md as the canonical API/CLI surface. Trim README to landing-page role (install + one minimal example + doc map). Fix tutorial bug (DType.UTF8 → new DType.Utf8(false)) and drop reference creep (PType enum, CLI section). Drop wrong operator list in how-to (Neq/Gt/Lt are not in the Java API) and link to reference instead. Add cross-links between explanation, reference, and compatibility. Add TODO entry to expose Neq/Gt/Lt on RowFilter. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 649a076 commit b750f60

7 files changed

Lines changed: 291 additions & 108 deletions

File tree

README.md

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ for zero-copy memory-mapped reads.
3131
</dependency>
3232
```
3333

34-
### Read a Vortex file
34+
### Minimal read example
3535

3636
```java
3737
try (VortexReader vf = VortexReader.open(Path.of("data/example.vortex"));
@@ -47,82 +47,22 @@ try (VortexReader vf = VortexReader.open(Path.of("data/example.vortex"));
4747
```
4848

4949
> **Note:** `iter.hasNext()` closes the previous chunk's arena. Access all column data
50-
> before calling `hasNext()` again.
50+
> before calling `hasNext()` again. See [docs/explanation.md#memory-model](docs/explanation.md#memory-model).
5151
52-
### Write a Vortex file
53-
54-
```java
55-
var schema = new DType.Struct(
56-
List.of("timestamp", "value"),
57-
List.of(new DType.Primitive(PType.I64, false),
58-
new DType.Primitive(PType.F64, false)),
59-
false);
60-
61-
try (var ch = FileChannel.open(Path.of("out.vortex"), CREATE, WRITE);
62-
var writer = VortexWriter.create(ch, schema, WriteOptions.defaults())) {
63-
writer.writeChunk(Map.of(
64-
"timestamp", new long[] {1_700_000_000L, 1_700_000_001L},
65-
"value", new double[] {1.23, 4.56}
66-
));
67-
}
68-
```
69-
70-
### Scan with options
71-
72-
```java
73-
// project columns + limit rows
74-
ScanOptions opts = ScanOptions.all()
75-
.withColumns("timestamp", "value")
76-
.withLimit(1_000);
77-
78-
// add a row filter
79-
ScanOptions filtered = ScanOptions.all()
80-
.withFilter(new RowFilter.Gte("price", 100))
81-
.withLimit(50);
82-
```
83-
84-
### Handle unknown encodings
85-
86-
Files containing unrecognised encoding IDs throw `VortexException` by default.
87-
Opt in to passthrough mode to read such files without failing:
88-
89-
```java
90-
EncodingRegistry registry = EncodingRegistry.loadAll().allowUnknown();
91-
try (VortexReader vf = VortexReader.open(path, registry)) {
92-
// columns with unknown encodings are returned as UnknownArray
93-
}
94-
```
95-
96-
## CLI
97-
98-
The `cli` module ships a fat jar with subcommands for inspecting and querying Vortex files.
99-
100-
```bash
101-
./mvnw package -pl cli -am -DskipTests
102-
java -jar cli/target/vortex.jar <subcommand> [args]
103-
```
104-
105-
| Subcommand | Syntax | Description |
106-
|---|---|---|
107-
| `inspect` | `inspect <file.vortex>` | Print file structure (layout tree, encodings, row counts) |
108-
| `schema` | `schema <file.vortex>` | Print column types |
109-
| `count` | `count <file.vortex>` | Print total row count |
110-
| `stats` | `stats <file.vortex>` | Print per-column min/max statistics |
111-
| `export` | `export <file.vortex>` | Write all columns to CSV on stdout |
112-
| `select` | `select <file.vortex> <col> [col2 ...]` | Project specific columns to CSV |
113-
| `filter` | `filter <file.vortex> <expr>` | Filter rows to CSV (e.g. `"price >= 100"`) |
114-
| `import` | `import <file.csv\|file.parquet> [out.vortex]` | Convert CSV or Parquet to Vortex |
52+
For more examples — writing, projection, filtering, custom encodings, and the CLI —
53+
see the documentation below.
11554

11655
## Documentation
11756

118-
Docs follow the [Diátaxis](https://diataxis.fr/) framework (tutorial, how-to, reference, explanation).
57+
Docs follow the [Diátaxis](https://diataxis.fr/) framework.
11958

120-
| Document | Contents |
121-
|---|---|
122-
| [docs/tutorial.md](docs/tutorial.md) | Step-by-step: write and read your first Vortex file |
123-
| [docs/how-to.md](docs/how-to.md) | Recipes: count rows, convert Parquet, filter, project, custom encodings |
124-
| [docs/compatibility.md](docs/compatibility.md) | Encoding support table, S3 fixture status |
125-
| [docs/explanation.md](docs/explanation.md) | Design rationale, memory model, testing strategy, benchmarks |
59+
| Document | Mode | Contents |
60+
|---|---|---|
61+
| [docs/tutorial.md](docs/tutorial.md) | Tutorial | Step-by-step: write and read your first Vortex file |
62+
| [docs/how-to.md](docs/how-to.md) | How-to | Recipes: count rows, convert Parquet, filter, project, custom encodings |
63+
| [docs/reference.md](docs/reference.md) | Reference | API surface, CLI subcommands, operator tables, file-format trailer |
64+
| [docs/compatibility.md](docs/compatibility.md) | Reference | Encoding support table, S3 fixture status |
65+
| [docs/explanation.md](docs/explanation.md) | Explanation | Design rationale, memory model, testing strategy, benchmarks |
12666

12767
## Development
12868

TODO.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474

7575
## API
7676

77+
- [ ] Add `RowFilter.Neq`, `RowFilter.Gt`, `RowFilter.Lt` to the Java API. Currently only `Gte`, `Lte`, `Eq`, `And` are exposed; the CLI lowers `>`, `<`, `!=` onto the supported set.
78+
7779
- [ ] Use domain primitives (`UInt32`, `UInt64`, etc.) as value classes via Project Valhalla instead of raw `long`/`int`
7880
- See https://dfa1.github.io/articles/rethink-domain-primitives-with-valhalla
7981
- Candidates: `PType` integer kinds, buffer offsets, row indices, byte lengths

docs/compatibility.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Compatibility
22

33
Tested against the [Rust reference implementation](https://github.com/spiraldb/vortex) v0.72.0.
4+
For the rest of the API surface (reader, writer, scan, CLI), see [reference.md](reference.md).
45

56
## Encodings
67

docs/explanation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ no upgrade risk, and a supported LTS for users.
2727

2828
## Memory model
2929

30-
`VortexFile` memory-maps the entire file into one `MemorySegment` (confined `Arena`).
30+
`VortexReader` memory-maps the entire file into one `MemorySegment` (confined `Arena`).
3131
All `Array` buffers returned during a scan are zero-copy slices of that segment — their
32-
lifetime is tied to the `VortexFile`. Close the file to release the mapped region.
32+
lifetime is tied to the `VortexReader`. Close the reader to release the mapped region.
3333

3434
The iterator-based scan API is load-bearing: `iter.hasNext()` closes the previous chunk's
3535
arena. Access all column data before calling `hasNext()` again.
3636

37+
For the reader / scan method signatures, see [reference.md#reader-api](reference.md#reader-api).
38+
3739
## Testing strategy
3840

3941
Unit tests verify internal correctness (encoding round-trips, edge cases), but the format

docs/how-to.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# How-to guides
22

33
Task-oriented recipes. Each section solves one concrete goal.
4+
For API details (classes, methods, operator tables), see [reference.md](reference.md).
5+
For the design rationale behind the iterator lifecycle, see [explanation.md#memory-model](explanation.md#memory-model).
6+
7+
---
8+
9+
## Build the CLI
10+
11+
Build the fat jar once; reuse it for every CLI recipe below:
12+
13+
```bash
14+
./mvnw package -pl cli -am -DskipTests
15+
java -jar cli/target/vortex.jar <subcommand> [args]
16+
```
17+
18+
For the full subcommand list, see [reference.md#cli](reference.md#cli).
419

520
---
621

@@ -101,16 +116,16 @@ RowFilter filter = new RowFilter.Gte("volume", 1_000_000)
101116
.and(new RowFilter.Lte("price", 200.0));
102117
```
103118
104-
Supported operators: `Eq`, `Neq`, `Lt`, `Lte`, `Gt`, `Gte`.
119+
For the supported predicate set and CLI operator syntax, see
120+
[reference.md#rowfilter](reference.md#rowfilter-iogithubdfa1vortexscanrowfilter)
121+
and [reference.md#filter-expression-syntax](reference.md#filter-expression-syntax).
105122
106123
**CLI:**
107124
108125
```bash
109126
java -jar cli/target/vortex.jar filter trades.vortex "volume >= 1000000"
110127
```
111128
112-
Filter operators: `>`, `>=`, `<`, `<=`, `=`, `==`. Values parsed as integer, double, boolean, or string.
113-
114129
---
115130
116131
## Preview the first N rows

0 commit comments

Comments
 (0)