Commit 3f0efa6
feat(writer): type-aware global-dict cardinality cap for Utf8 (#299)
The global-dict admission cap was a single 2048 constant. It was kept low because
a global dict pessimizes high-cardinality F64/I64 columns (ALP/bitpacked beat U16
dict codes) — but that ceiling also excluded text columns with thousands of
repeated distinct values (nyc-311 street/place names, 9k-28k distinct), pushing
them into costlier per-chunk fallbacks.
Split the cap: numeric stays 2048; Utf8 rises to 32768, the positive ceiling of
the per-chunk short[] code buffer (codePTypeForSize already emits U16 codes above
256, so no wire change). Threaded through isUtf8DictCandidate and the mid-file
ingest gate via the column's type.
Note: on very wide, high-cardinality text files the aggregate retained-code budget
(WriteOptions.globalDictMaxRetainedBytes, default 1 GB) may evict/demote columns;
the ADR-0021 eviction keeps this safe (no OOM) but may cap the realized gain until
the budget is tuned — deferred to measurement on the full corpus.
Verified: an 8000-distinct Utf8 column now produces a global DICT layout and
round-trips (integration test); dict-decision unit tests updated for the raised cap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d83d1b9 commit 3f0efa6
3 files changed
Lines changed: 69 additions & 7 deletions
File tree
- integration/src/test/java/io/github/dfa1/vortex/integration
- writer/src
- main/java/io/github/dfa1/vortex/writer
- test/java/io/github/dfa1/vortex/writer
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
92 | 138 | | |
93 | 139 | | |
94 | 140 | | |
| |||
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| |||
1297 | 1307 | | |
1298 | 1308 | | |
1299 | 1309 | | |
| 1310 | + | |
1300 | 1311 | | |
1301 | 1312 | | |
1302 | 1313 | | |
1303 | 1314 | | |
1304 | | - | |
| 1315 | + | |
1305 | 1316 | | |
1306 | 1317 | | |
1307 | 1318 | | |
| |||
1314 | 1325 | | |
1315 | 1326 | | |
1316 | 1327 | | |
1317 | | - | |
| 1328 | + | |
1318 | 1329 | | |
1319 | 1330 | | |
1320 | 1331 | | |
| |||
1667 | 1678 | | |
1668 | 1679 | | |
1669 | 1680 | | |
1670 | | - | |
| 1681 | + | |
1671 | 1682 | | |
1672 | 1683 | | |
1673 | 1684 | | |
1674 | 1685 | | |
1675 | 1686 | | |
1676 | | - | |
| 1687 | + | |
1677 | 1688 | | |
1678 | 1689 | | |
1679 | 1690 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| |||
0 commit comments