feat: add tabular + columnar side indexes - #58
Open
pathscale wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Storage-flavor boundary
WorkTable now has a clear three-flavor model:
This PR deliberately implements the low-cost middle flavor. It does not claim to be a full column store.
Summary
columnarsyntax without introducing a table layout switchcolumnar_indexeswith one meaningful key declaration:cluster_byconfig.columnar_slot_idandconfig.columnar_chunk_rowsColumnSlotId8|16|32|64, defaulting to 32 bits, without replacing the primary keyBTreeMapside-index metadataIdentity and correctness
ColumnSlotIduses the full configured width only as a compact side-vector position. It is neither sort rank nor durable identity.ColumnarRowRefis opaque and validates:This closes the same-primary-key delete/reinsert ABA hole without reducing the configured live-slot capacity. Generation never wraps; an exhausted generation permanently retires that slot. The table incarnation rejects references from a different or reopened instance. Only
primary_key()is public, and the reference is not serializable.Choosing a slot width large enough for maximum simultaneously live columnar rows is the schema author's responsibility. Exhaustion returns
WorkTableError::ColumnSlotIdExhausted(bits), rolls back the authoritative mutation, and never widens, truncates, wraps, evicts, or panics.DSL corrections from expert review
columnaruses the table chunk defaultcolumns: [...]inside a side index is rejected as semantically redundantincludeis reserved and rejected until covering projection existscompression(none)is accepted; inertauto/delta/rle/dictionarydeclarations are errorscolumnar, unknown/non-columnar cluster keys, duplicate config, method-name collisions, unknown postfix attributes, and unsupportedworktable_version!syntax are rejectedCurrent implementation boundary
Vec<Vec<Option<T>>>; no SIMD/vector kernel, validity bitmap, string arena, codec, or native side-index disk format is claimedVecvalues and materialize the resultscan_batchesare follow-upsRwLockgives each operation a coherent side-index snapshot but serializes concurrent side-index writerscolumnar_is_dirty()andrebuild_columnar()let applications schedule the current whole-table rebuild costSAP HANA comparison
The v3 guide compares this work with Sikka et al., Efficient Transaction Processing in SAP HANA Database: The End of a Column Store Myth (SIGMOD 2012). HANA's L1 row delta → L2 column delta → compressed main lifecycle is precedent for a future full-columnar flavor. The honest analogy here is narrower: WorkTable retains its tabular engine and adds optional uncompressed side indexes; it does not implement HANA's L2/main lifecycle or vector execution.
Validation
cargo test --all-features: 171 library tests passed; 524 integration tests passed, 5 intentionally ignored; 2 doctests passedUsingcoverage passes with WorkTablesIndex, congee, and arctic primary backendscargo clippy --all-targets --all-features -- -D warningscargo check --no-default-featurescargo fmt --all -- --checkDocuments
docs/columnar-index-plan.md— implementation plan and scope boundarydocs/columnar-fields-and-indexes-guide-v3.md— complete technical/reviewer guide, including the HANA comparisonoutput/pdf/worktable-columnar-side-indexes-guide-v3.pdf— visually reviewed 9-page PDFPerformance claims remain gated on the
wt-benchmarksmatrix: tabular baseline vs fields-only vs fields-plus-clustered side indexes, row-path overhead, p50/p95/p99, concurrency, allocations, memory, code size, dirty rebuild, persisted reload, and all supportedUsingbackends.