Repository navigation
Add test: Zero-area box items == 0 fallback VALUE in geohashesInBox is unasserted (PR tests use ignore) - #113112
Conversation
|
Pre-PR Validation Gate (per ClickGap pipeline): a) Deterministic repro? ✅ b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? / New tests added? ✅ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
Workflow [PR], commit [d7c206f] Summary: ❌
AI ReviewSummaryThis PR adds a new stateless regression test for the Findings
Final VerdictStatus: Align the public contract for equal-bound boxes with this new assertion: either document singleton point-box results or stop pinning them here. |
Replace `(0,0)-(180,0)` / `(0,0)-(0,90)` line boxes with point boxes so the pinned single-geohash value is well-defined; add an off-origin point box `(180,90,180,90)` to prove the fallback encodes the actual corner. Requested by @clickhouse-gh[bot] in ClickHouse#113112 (comment)
| -- unresolved (see 04694_geohashes_in_box_degenerate_span.sh, termination only). | ||
|
|
||
| -- Point box at the origin: both grid axes have zero items. | ||
| SELECT geohashesInBox(0., 0., 0., 0., 12); |
There was a problem hiding this comment.
This now pins geohashesInBox(0., 0., 0., 0., 12) to return a singleton geohash, but the public contract still says the function returns [] when the minima are not less than the maxima. FunctionDocumentation::ReturnedValue in src/Functions/geohashesInBox.cpp and docs/en/sql-reference/functions/geo/geohash.md both describe equal-bounds boxes as empty.
That means this test is freezing behavior users are currently told not to rely on. Can we either update the user-visible contract alongside this, or keep the test at a termination-only shape until point-box results are documented intentionally?
There was a problem hiding this comment.
You're right. Both the doc-string (src/Functions/geohashesInBox.cpp:242) and docs/en/sql-reference/functions/geo/geohash.md:109 document [] for a box whose minima aren't less than its maxima — which is exactly the point box (0., 0., 0., 0.). My test pinned a singleton, freezing behavior the public contract tells users not to rely on. The finding's stated impact — a documented single result being dropped — was itself wrong: the docs document empty, not a singleton.
Reducing to a termination-only shape wouldn't add value either: a point box hits the items == 0 fallback immediately and has no unbounded loop to bound (that's precisely what 04694_geohashes_in_box_degenerate_span.sh guards for the line-degenerate axes). Nothing is left for this test to legitimately assert without a maintainer decision on the contract.
Separately worth flagging: the code returns a singleton for a point box while the docs say [] — a genuine doc/code mismatch, but which side is authoritative is a semantics call for the function owners, not something this test should pin. Closing.
There was a problem hiding this comment.
You're right. Both the doc-string (src/Functions/geohashesInBox.cpp:242) and docs/en/sql-reference/functions/geo/geohash.md:109 document [] for a box whose minima aren't less than its maxima — which is exactly the point box (0., 0., 0., 0.). My test pinned a singleton, freezing behavior the public contract tells users not to rely on. The finding's stated impact — a documented single result being dropped — was itself wrong: the docs document empty, not a singleton.
Reducing to a termination-only shape wouldn't add value either: a point box hits the items == 0 fallback immediately and has no unbounded loop to bound (that's precisely what 04694_geohashes_in_box_degenerate_span.sh guards for the line-degenerate axes). Nothing is left for this test to legitimately assert without a maintainer decision on the contract.
Separately worth flagging: the code returns a singleton for a point box while the docs say [] — a genuine doc/code mismatch, but which side is authoritative is a semantics call for the function owners, not something this test should pin
|
Reviewed, and I recommend merging this. The gap is real, and my own earlier reasoning against it was wrong. I mutated the source this test guards, using the exact regression named in the risk statement (an early
On #112976 I argued that One correction to the risk statement, in your favour. A regression here does not return Also checked: the pinned values agree with The |
|
CI failure in |
|
Both reds are unrelated to this change, and neither is cleared by merging master.
Your summary comment lists a second red that the question omits: Separately, PR CI checks out the merge of your head with master rather than your head ( Retriggering is your call on your own branch. Neither red is a signal against this PR. |
ec2250f
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.
This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.
Adds test coverage for 1 untested code path(s), found during automated review of PR #112976.
That PR The PR modifies
geohashesInBoxinsrc/Functions/GeoHash.cpp. It wraps the nested grid-walk loops in a new guardif (args.longitude_items != 0 && args.latitude_items != 0)so that a zero-area box (bounds equal on one axis, e.g.geohashesInBox(0., 0., 180., 0., 12), or-0.0vs0.0) no long1. Zero-area box
items == 0fallback VALUE ingeohashesInBoxis unasserted (PR tests useignore)src/Functions/GeoHash.cpp:335,src/Functions/GeoHash.cpp:355Risk:
executeImpl->execute<...>->geohashesInBox(geohashesInBox.cpp:166): the new guard at GeoHash.cpp:335 skips the loops when either axis has zero items, soitemsstays 0 and the fallback at GeoHash.cpp:355 emitsgeohashEncodeImpl(longitude_min, latitude_min, ...). RISK: if the loop-skip guard and the fallback interaction regress (e.g. an earlyreturn items;for a zero-item axis), a zero-area/point-box query silently returns[]instead of the covering geohash — wrong results for …What's unique vs PR tests: The PR's 04694 test asserts the degenerate cases only via
sum(ignore(...))= 0, which is identical for an empty array and a single-element array — it verifies the query terminates but is blind to the returned VALUE. 04648 asserts the reversed/NaN empty-array path and a non-degenerate expanding box, not the zero-area fallback value. This test pins the actual['s00000000000']result that the fix promises is unchanged.Try it on ClickHouse Fiddle
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — test-only change.
Documentation entry for user-facing changes
Version info
26.8.1.733(included in26.8and later)