Skip to content

Core: Handle projected geo bounds in ContentStatsBackedMap - #19050

Closed
stevenzwu wants to merge 3 commits into
apache:mainfrom
stevenzwu:content-stats-partial-geo-bound
Closed

stevenzwu wants to merge 3 commits into
apache:mainfrom
stevenzwu:content-stats-partial-geo-bound

Conversation

@stevenzwu

@stevenzwu stevenzwu commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

ContentStatsBackedMap reads geo bound coordinates by fixed position (x, y, z, m), so a stats struct projected to a subset of coordinates fails with ArrayIndexOutOfBoundsException or returns the wrong coordinates. This can't happen today because V4ManifestReader restores the full geo bound struct, but that restore is being reverted in #19070 .

Coordinates are now looked up by field name. A bound projected without x or y is left out of the map, because the x:y[:z][:m] byte encoding requires both. isKnown treats such a bound as unknown, so a view whose only bounds are partial geo bounds is still null.

Test plan:

  • projectedGeoBoundsInView: a geometry bound projected without x or y is omitted, while a geography bound projected to (x, y, m) is encoded correctly alongside a primitive column.
  • factoryReturnsNullWhenOnlyPartialGeoBounds: when the only bounds are partial geo bounds, lowerBounds and upperBounds return null instead of an empty view.

AI Disclosure

  • Prompt Summary: Fix ContentStatsBackedMap reading projected geo bound structs by fixed position, with tests;
  • code and tests were generated, reviewed, and iterated on with the author.

ContentStatsBackedMap read geo bound coordinates by fixed position, so a
bound projected to a subset of x, y, z, and m failed or returned the wrong
coordinates. Look up coordinates by field name, and leave a bound out of
the map when x or y is not projected because the bound encoding requires
both. An empty view is still null when the only bounds are partial.

Generated-by: Cursor (Claude Opus 5.5)
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the core label Nov 20, 2026
stevenzwu and others added 2 commits November 19, 2026 22:48
isKnown no longer encodes a bound to decide whether it is known. It
checks the projected bound type instead: a geo bound projected without
x or y cannot be encoded, so it is treated as unknown, consistent with
the entries the view returns.

Generated-by: Cursor (Claude Opus 5.5)
Co-authored-by: Cursor <cursoragent@cursor.com>
The new name states that the helper checks whether a bound type projects the geo X/Y fields.

Generated-by: Cursor (Claude Opus 5.5)
Co-authored-by: Cursor <cursoragent@cursor.com>
case LOWER_BOUND -> fieldStats.lowerBound() != null;
case UPPER_BOUND -> fieldStats.upperBound() != null;
case LOWER_BOUND -> hasBound(fieldStats, fieldStats.lowerBound(), StatsUtil.LOWER_BOUND_NAME);
case UPPER_BOUND -> hasBound(fieldStats, fieldStats.upperBound(), StatsUtil.UPPER_BOUND_NAME);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to change. This can still produce a map. But if there isn't enough information to produce a serialized geo bound, then it can be null when producing the lower or upper bound value.

@stevenzwu stevenzwu closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants