Skip to content

docs(alter): document SET SORTED BY ASC/DESC and CSR - #33

Merged
adsharma merged 1 commit into
mainfrom
docs/csr-782-799
Oct 6, 2026
Merged

adsharma merged 1 commit into
mainfrom
docs/csr-782-799

Conversation

@adsharma

@adsharma adsharma commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Documents SET SORTED BY ASC/DESC + CSR in src/content/docs/cypher/data-definition/alter.md for LadybugDB/ladybug#782 and #799.

  • Node non-CSR ASC/DESC matrix: any existing column(s), ASC/DESC, single or composite (mixed directions allowed); metadata only — no ordering enforced, no watermark, no optimizer effect. New declaration replaces prior metadata; plain form clears CSR flag; RENAME COLUMN follows renames; unknown columns rejected; visible in EXPLAIN.
  • Node CSR (#782): exactly one property, ASC, must be the primary key (single ascending PK + CSR). DESC, composite, or non-PK with CSR rejected. User assertion (primary_key == rowid, csr_index interchangeable with table_offset); not verified from data. Sets CSR flag + change-epoch watermark; mutation invalidates and optimizer silently disregards flag. Enables offset-count degree rewrite and COUNT(DISTINCT nbr) bounded per-depth BFS rewrite when conditions met.
  • Rel CSR (#799): CSR keyword required on rel tables; only (FROM ASC, TO ASC) accepted (FROM/TO are structural endpoint names, not properties). User assertion — storage does not sort at checkpoint; declare only on pre-sorted data. Lets CSRArrowArrays::symmetrize() skip per-row sort; csrChangeEpoch watermark recorded; post-declaration mutation falls back to safe per-row sort.
  • Validation + invalidation semantics: binder exceptions for each rejected shape; watermark/invalidation behavior for both node and rel CSR.
  • Verification: npm run build passes.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ladybug-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: bddffe9
Status: ✅  Deploy successful!
Preview URL: https://cb7e2183.ladybug-docs.pages.dev
Branch Preview URL: https://docs-csr-782-799.ladybug-docs.pages.dev

View logs

@adsharma
adsharma merged commit c21862f into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant