docs: the section 8 parallel Scan example differs from the statement scan_impl emits, and its portability note repeats two lines

Open Beginner friendly
#1,413 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, rust, sql

Research direction

Start with section 8 of docs/design/04-component-storage.md, lines 776 to 804, and compare its segment 2 SQL with the predicate and ORDER BY that scan_impl builds in crates/storage-postgres/src/data/query_scan.rs. Done when the example uses the emitted predicate and COLLATE "C" ordering, and the repeated portability-note lines are removed. No test is named, so check the rendered Markdown by eye.

Written by the indexing model from the issue text.

Description

docs/design/04-component-storage.md, section 8, "Parallel Scan Segment Assignment" (lines 776 to 804 on main at 44cd43667), shows this statement for segment 2 of 4:

SELECT item_data FROM _ddb_Users
WHERE (hashtext(pk)::bigint & x'7FFFFFFF'::bigint) % 4 = 2
ORDER BY pk, sk_s
LIMIT $limit;

scan_impl in crates/storage-postgres/src/data/query_scan.rs emits (hashtext(pk)::bigint & 2147483647) % 4 = 2 for the segment predicate, and ORDER BY pk, sk_s COLLATE "C" for a base table with a string sort key. The mask has the same value in both forms, and the COLLATE "C" is the byte order the doc describes in section 5.1. The texts differ.

The portability note that follows ends with two lines that repeat the end of the sentence before them:

> hash function in the `core` crate (e.g., CRC32 of the partition key bytes)
> that all backends use, and pass the pre-computed segment filter to the
> storage backend.
> crate (e.g., CRC32 of the partition key bytes) that all backends use, and pass the pre-computed segment filter to the
> storage backend.

Proposed change: copy the emitted predicate and ORDER BY into the example, and remove the two repeated lines.

Dominant language
Rust
Stars
517
Forks
60
Avg merge
3d 21h
Merged PRs (30d)
116

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ExtendDB/extenddb

All issues in ExtendDB/extenddb

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.