Skip to content

Count qualifying comprehension elements without building a list - #38

Merged
prrao87 merged 1 commit into
codex/issue-18-prerequisitesfrom
codex/issue-18-curated
Oct 26, 2026
Merged

prrao87 merged 1 commit into
codex/issue-18-prerequisitesfrom
codex/issue-18-curated

Conversation

@stugorf

@stugorf stugorf commented Oct 26, 2026

Copy link
Copy Markdown
Member

Problem and change

Issue18. Proposed branch codex/issue-18-curated at 4bc6eeae6a6f0c71bb23559b3c81387a49970836; actual comparison base codex/issue-18-prerequisites at 07a0fa1246c1829f4184e7d33c5fa063a4a76f19 (pagination90 plus alias-scope21).

A direct size([x IN values WHERE predicate]) now counts the qualifying rows without collecting an intermediate list. The existing element stream, predicate and correlated EXISTS behavior remain responsible for membership and multiplicity. Empty/null lists produce zero; duplicate elements and duplicate outer rows retain their counts. Mapped comprehensions and pattern comprehensions keep normal list behavior.

Validation

Head 4bc6eeae6a6f0c71bb23559b3c81387a49970836; frozen parent 07a0fa1246c1829f4184e7d33c5fa063a4a76f19. Focused checks and regression details record commands, results, documentation and compatibility. The release receipt pins wheel/archive identity and 36 installed tests.

Both complete workloads pass unchanged goldens in memory and lazy modes. Retained first-pass geometric mean speedups are below (greater than one is faster). Per-query results and paired investigations remain in the audit archive.

Workload/mode Main Actual parent
Q30 memory 0.988 0.999
Q30 lazy 0.934 0.968
IC memory 1.003 1.005
IC lazy 1.040 1.046

Measurements use the same Apple M4 Max (16 cores, 128 GiB), macOS 26.6.2 arm64 and Python 3.13.17, with Q30 revision 6260689 and IC revision c185123. Reproduction instructions pin settings, data checksums, locks and commands. The frozen main baseline is code-identical to current main 90114f3; the equivalence check also verifies clean prospective main-target merges.

Individual review gates pass under the recorded repeat/controlled-investigation rules. Initial failed measurements remain intact in the audit record.

User impact

Cardinality-only filtered comprehensions use existential counts without multiplying items by matching-edge count. Returned lists keep general planning. Null/empty/duplicate semantics and supported optimization shapes are documented.

Review ledger · Current contribution guide

Audit archive: 47,675,190 bytes; SHA-256 b3486fb30a34639c830b5d49353b3838f96369f95df959ac35f85511f7f8b2de. The small current-main supplement preserves the documentation update. Original absolute paths in receipts map to included records through the archive index.

Submitted by David Hughes (@stugorf), with AI Collaboration.

Specialize size() of unmapped list comprehensions to filtered COUNT(1), preserving null elements, duplicates, padding and input-row multiplicity. Keep mapped and pattern comprehensions on their existing path. Document the non-nullable Arrow count field and add focused plan/result tests plus a reference benchmark.

Part of #18. Isolated Rust suite: 349 passed, one optional timing diagnostic ignored. Formatting, focused Ruff and strict docs passed. Python, benchmark and SF1 measurements pending; no performance claim.

Submitted by David Hughes (@stugorf), with AI Collaboration.
@prrao87
prrao87 marked this pull request as ready for review October 26, 2026 16:49
@prrao87
prrao87 merged commit 929a3dc into codex/issue-18-prerequisites Oct 26, 2026
8 checks passed
@prrao87
prrao87 deleted the codex/issue-18-curated branch October 26, 2026 16:53
@prrao87

prrao87 commented Oct 26, 2026

Copy link
Copy Markdown
Member

This change merged into an intermediate branch, not main. It reached main through #55, which brought in the final integrated version of this work with every original commit kept on its branch. Follow-up fixes from review are listed there.

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.

2 participants