Skip to content

Core: Read geometry and geography bounds as GeospatialBound - #18394

Open
stevenzwu wants to merge 2 commits into
apache:mainfrom
stevenzwu:geospatial-bound-struct-like
Open

stevenzwu wants to merge 2 commits into
apache:mainfrom
stevenzwu:geospatial-bound-struct-like

Conversation

@stevenzwu

@stevenzwu stevenzwu commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Materialize v4 manifest geometry and geography lower and upper bounds as GeospatialBound so callers receive the bound type, and copy reused reader instances when field stats are copied.

This is a follow-up on Ryan's review comment.

private static Object copyBound(Object bound) {
if (bound instanceof byte[] bytes) {
return copyOf(bytes);
} else if (bound instanceof StructLike struct) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the usage PartitionData and updated serialization test in TestFieldStatsStruct so that we can remove this copy branch.

@stevenzwu
stevenzwu force-pushed the geospatial-bound-struct-like branch from 0285f3d to 5cb995d Compare October 7, 2026 04:28
stevenzwu and others added 2 commits October 6, 2026 21:40
Materialize v4 manifest geometry and geography lower and upper bounds as GeospatialBound so callers receive the bound type, and copy reused reader instances when field stats are copied.

Generated-by: Grok 4.7
Co-authored-by: Cursor <cursoragent@cursor.com>
Geo field stats now store GeospatialBound, so copyBound no longer copies an arbitrary StructLike. GeospatialBound is Serializable, and the InternalData test read registers that type when the column is geometry or geography.

Generated-by: Grok 4.7
@stevenzwu
stevenzwu force-pushed the geospatial-bound-struct-like branch from 5cb995d to 3de75a4 Compare October 7, 2026 04:40
@stevenzwu
stevenzwu requested a review from nastra October 7, 2026 04:53
@stevenzwu

Copy link
Copy Markdown
Contributor Author

cc @anoopj

}

@Test
public void testStructLikeXYZM() {

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.

nit: maybe also test XYM and XYZ as the other tests do


private void registerGeospatialFieldStatsBounds(
InternalData.ReadBuilder readBuilder, Types.NestedField fieldStats) {
Types.NestedField tableField = tableSchema.findField(StatsUtil.toFieldId(fieldStats.fieldId()));

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'm not sure we need the table schema for that. The stats schema should already have that information.
Essentially only GEO lower/upper fields are structs, so I think we could fetch that info from the Stats schema rather than having to pass table schema

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants