model-writtenrun 4442 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Jul - Aug 2022 · 12 entries
- Martin Kalcher proposed a C shuffle for large integer arrays after measuring much slower SQL processing, with random sampling and random chunk assignment as motivating uses #1; a NumPy experiment did not improve performance #3.
- Thomas Munro redirected the proposal to pgsql-hackers and requested a patch, algorithm comments, upgrade SQL, and tests #5, leading Martin to submit intarray shuffle() and sample() together #6.
- David G. Johnston identified tests that could fail when independently random results happened to match #8, while Tom Lane proposed implementing generic core functions instead of an intarray-only feature #10.
- Martin produced a generic reference-shuffling prototype #15 and then specialized four-byte and eight-byte paths #20, but Tom Lane recommended PostgreSQL's existing array deconstruction and construction APIs and rejected excessive specialization #17 #18.
- Martin replaced the raw representation handling with Datum and null-flag arrays #23, then added array_sample(), documentation, and regression tests to create a review-ready core patch #26.
- Robert Haas identified inconsistent multidimensional and full-size sampling behavior #29, and Aleksander Alekseev supported preserving inner arrays #39; after reconsidering existing array operations, Tom Lane endorsed first-dimension shuffling and sampling #44, implemented in a shared helper by #45.
- The discussion considered preserving original sample order and adding algorithm options, but Martin argued that unordered samples matched established implementations #38, and Robert Haas opposed expanding the interface substantially #41; flattening was discussed as a separate reusable function rather than an option on shuffle #43.
- Dean Rasheed caught missing VOLATILE markings and recommended unbiased PostgreSQL PRNG calls #46, which Martin implemented alongside parallel restrictions in #50.
- Dean and Martin explored sharing a user-facing PRNG with random() and setseed() #48 #51, and Martin introduced a separate user_prng module with deterministic seeded tests #52 before moving the array functions into array_userfuncs.c #55.
- Fabien COELHO's review prompted prototype and inline fixes, clearer pointer-based swapping, full-size sample shuffling, and NULL and three-dimensional tests #56 #57; his argument for an exact sample size then led to out-of-range errors and updated setseed() documentation #58 #59.
- Martin refreshed the patch in August #60 and adapted it to the newly merged Meson build in September after Andres Freund identified the missing source registration #61 #62.
- Both core functions had landed by the thread's end, while sampling with replacement and other optional interfaces discussed in #46 and #34 were not included; Salek Talangi subsequently reported that the shuffle comment's phrase about a later item misleadingly excludes self-selection, with no response or corrective patch shown after #76.
Sep 2022 · 2 entries
- Tom Lane rejected broadening access to random()'s private PRNG because it would reintroduce unwanted interactions #63; Fabien suggested the existing global state #65, Tom agreed #66, and Martin removed the shared-seed infrastructure and rewrote the tests accordingly #67.
- Tom's next review requested resetting array_sample()'s first lower bound, clearer multidimensional documentation and swap comments, direct TypeCacheEntry passing, and removal of unnecessary parallel restrictions #68.
Mar - Apr 2023 · 3 entries
- After months without an author update, Gregory Stark returned the patch with feedback #70, but Daniel Gustafsson immediately revived Martin's work and submitted a revised patch addressing most outstanding comments #71.
- Tom explained why sampled items should receive a first lower bound of 1 while inner slice bounds remain intact #72, and Daniel agreed that this remaining change was needed #73.
- Tom completed the lower-bound change, refined indexing and documentation, and committed #71 with moderate edits as 888f2ea0a8, crediting Martin as author and Daniel and himself for review and adjustments; he announced the push in #74.