The analyze() comment still claims null_frac comes from the zone maps (#485) - #498
Conversation
…c comes from the zone maps commandprompt#488 moved null_frac off the zone maps and onto the same read as n_distinct, because the zone-map counts describe what was written and a DELETE left the fraction normalised against rows the table no longer held. It did not update the COMMENT ON FUNCTION, which still tells the user the opposite: taking null_frac exactly from the zone maps rather than sampling That is my own omission from commandprompt#488. It is user-visible through \df+ and through the extension script, and it is the kind of stale claim that is believed because it is adjacent to correct code. The replacement says what is now true and adds the property that matters more than the source: null_frac, n_distinct and the most-common frequencies all come from one read, so they describe one population. That identity is what commandprompt#485 was actually about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRQYekvivA4RLDnndhanHK
jdatcmd
left a comment
There was a problem hiding this comment.
The change is right and the reasoning for it is right. One line short, in the same file.
Verified
The stale claim is on current main at pgcolumnar--1.0-alpha.sql:1428, it is user-visible through \df+, and the replacement is accurate: after #488 all three statistics do come from the one read. Adding the shared-population property rather than just correcting the source is the better fix, since that identity is what #485 was actually about.
The same claim survives 443 lines up
pgcolumnar--1.0-alpha.sql:985, the function's own header comment:
* Collected so far, all of it exact rather than sampled: null_frac from the zone
* maps (metadata only, no data read), n_distinct from reading one column, and
* from that same read the most-common values with their frequencies and a
* histogram of what remains once those are excluded.
null_frac from the zone maps (metadata only, no data read) is exactly the sentence this PR exists to remove, and the parenthetical makes it a stronger claim than the one at 1428: it does not merely say where the number comes from, it promises no data read. After #488 that read always happens.
It is a two-line wrap, which is why a single-line grep for the phrase does not find it. That is presumably how it survived the sweep.
Worth fixing here rather than in a third PR, since anyone who reads this one will reasonably assume the file no longer makes the claim.
Checked and clean
I swept the rest of the tree for the same shape. The only other occurrence is pgcolumnar--1.0-alpha.sql:1347, which is #488's own new comment explaining why nv is not derived as totalrows minus a zone-map null_frac. That one is correct and should stay.
Requesting changes only for the 985 hunk. With that in, this is ready.
|
Re-reviewed at Second pass on the replacement text itself, since a one-line PR deserves the line being checked rather than only the line it removes: it is accurate. After #488, Only the 985 hunk is outstanding. |
…er, 443 lines up
Review catch. The header comment at :985 said
null_frac from the zone maps (metadata only, no data read)
which is a stronger claim than the COMMENT ON FUNCTION this branch already
fixed: it does not merely name the source, it promises no data read. After commandprompt#488
that read always happens.
It survived my own sweep because it wraps across two lines, so a single-line
grep for the phrase cannot match it. Re-swept the whole tree with a multi-line
pattern; the only remaining occurrences are past-tense history in this file and
in test/analyze_function.sh, plus commandprompt#488's note at :1352 explaining why nv is NOT
derived from a zone-map null_frac, which is correct and stays.
Rewritten to lead with the property rather than the source: all of it exact,
all of it from ONE read, which is what makes every statistic describe one
population.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQYekvivA4RLDnndhanHK
|
Fixed and pushed as You are right that it is the stronger claim: On how it survived my sweep — it wraps across two lines, so a single-line The replacement leads with the property rather than the source, since "one read" is what makes the statistics describe one population, and that is the thing a future edit should be reluctant to break:
|
jdatcmd
left a comment
There was a problem hiding this comment.
54f6b039 fixes it, and does more than I asked for in the right direction.
I asked for the claim at :985 to be removed. What landed replaces it with the property rather than a corrected source:
all of it exact rather than sampled, and all of it from ONE read of the column
and then says why that is the point, including that null_frac came from the zone maps until #485 and was wrong after a DELETE because those counts describe what was written. A reader who arrives at that comment now learns the thing the old text was hiding.
Checked the new text rather than only the removal, since a one-line PR earns that: after #488 all four statistics do come from the single read, and "exact rather than sampled" still holds for each of them, the histogram included (its bounds are actual column values, and #488 moved their positions without making them estimates).
Approving.
Found while reviewing #497, which documents exactly this change. This is my own omission from #488.
#488 moved
null_fracoff the zone maps and onto the same read asn_distinct, because the zone-map counts describe what was written and aDELETEleft the fraction normalised against rows the table no longer held. It did not update theCOMMENT ON FUNCTION, which on current main still tells the user the opposite:User-visible through
\df+ pgcolumnar.analyzeand through the extension script. It is the kind of stale claim that gets believed precisely because it sits next to correct code.The replacement states what is true now, and adds the property that matters more than the source:
That identity is what #485 was actually about — the wrong value mattered less than two statistics in one
pg_statsrow being normalised against different populations.One line, no behaviour change, no test change.