Skip to content

Support geospatial statistics and bounding box metadata - #173

Closed
mghildiy wants to merge 4 commits into
hardwood-hq:mainfrom
mghildiy:geospatialStatsAndBboxMetadataSupport
Closed

Support geospatial statistics and bounding box metadata#173
mghildiy wants to merge 4 commits into
hardwood-hq:mainfrom
mghildiy:geospatialStatsAndBboxMetadataSupport

Conversation

@mghildiy

Copy link
Copy Markdown
Contributor

Added support for reading geospatial metadata #78 :

  • GeospatialStatisticsReader to read geospatial metadata captured by GeospatialStatistics
  • BoundingBoxReader to read boundingbox metadata captured by BoundingBox
  • simple-datagen.py extended to generate test parquet file containing geospatial metadata

@gunnarmorling gunnarmorling left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot! Some comments inline; in addition, could you also update the docs (under /docs) and exclude the regenerated Parquet test files, this should not be needed. Thx!

Comment thread core/src/test/java/dev/hardwood/GeospatialStatisticsTest.java Outdated
Comment thread core/src/test/java/dev/hardwood/GeospatialStatisticsTest.java Outdated
Comment thread core/src/main/java/dev/hardwood/metadata/BoundingBox.java Outdated
@mghildiy

Copy link
Copy Markdown
Contributor Author

Thanks a lot! Some comments inline; in addition, could you also update the docs (under /docs) and exclude the regenerated Parquet test files, this should not be needed. Thx!

I couldn't find any /docs directory, but I can see /_designs. Should I add a new doc here explaining how to extend simple-datagen.py, excluding changed parquet files from commit and so on?

@gunnarmorling

Copy link
Copy Markdown
Collaborator

It's here: https://github.com/hardwood-hq/hardwood/tree/main/docs. You may have to rebase to latest main. No need for a design doc, but updating those user-facing docs would be good.

@mghildiy
mghildiy force-pushed the geospatialStatsAndBboxMetadataSupport branch from 5d32d64 to 1fc5c33 Compare March 29, 2026 12:59
@gunnarmorling

Copy link
Copy Markdown
Collaborator

@mghildiy, pushed a commit with some minor fixes as I was taking another look.

Taking a step back though, what this PR is missing are the actual geo logical types; without those, reading the stats isn't really useful; i.e. we're taking step 2 before step 1 here. Can you amend this PR accordingly?

@mghildiy

mghildiy commented Mar 29, 2026 via email

Copy link
Copy Markdown
Contributor Author

@gunnarmorling

Copy link
Copy Markdown
Collaborator

How is it different from geospatial types we are currently reading?

That's the thing, we don't read any geospatial types yet, we solely retrieve statistics. We'll need logical types for GEOMETRY and GEOGRAPHY so consumers know how to interpret them. Also a predicate type for applying bounding box filters on these types. I have pushed another commit with a design doc (authored using Claude Code) which should clear things up.

@mghildiy

Copy link
Copy Markdown
Contributor Author

How is it different from geospatial types we are currently reading?

That's the thing, we don't read any geospatial types yet, we solely retrieve statistics. We'll need logical types for GEOMETRY and GEOGRAPHY so consumers know how to interpret them. Also a predicate type for applying bounding box filters on these types. I have pushed another commit with a design doc (authored using Claude Code) which should clear things up.

Ok, would go through design docs and implement the requirements.

@mghildiy

Copy link
Copy Markdown
Contributor Author

@gunnarmorling, which exact design document has new specs?

@gunnarmorling

Copy link
Copy Markdown
Collaborator

@mghildiy
mghildiy force-pushed the geospatialStatsAndBboxMetadataSupport branch 3 times, most recently from 2676777 to f51309c Compare April 5, 2026 12:36
@mghildiy
mghildiy force-pushed the geospatialStatsAndBboxMetadataSupport branch 4 times, most recently from 169a4e7 to 3fe9a32 Compare April 23, 2026 14:37
@gunnarmorling

Copy link
Copy Markdown
Collaborator

@mghildiy, what should we do with this one? DYT it's good for another review round (apart from the needed rebase)?

@mghildiy

Copy link
Copy Markdown
Contributor Author

@mghildiy, what should we do with this one? DYT it's good for another review round (apart from the needed rebase)?

We can have another round of review for it. I would commit the changes after rebase.

@mghildiy
mghildiy force-pushed the geospatialStatsAndBboxMetadataSupport branch 2 times, most recently from 3fe9a32 to b19a1cf Compare April 27, 2026 14:20
mghildiy and others added 4 commits April 30, 2026 20:31
1. Classes to capture geospatial metadata(BoundingBox.java, GeospatialStatistics.java)
2. Reader classes(BoundingBoxReader.java, GeospatialStatisticsReader.java)
3. Test for same(GeospatialStatisticsTest.java)
4. simple-datagen.py extended to generate test parquet file geospatial_stats_test.parquet
5. usage.md updated with sample code to access geospatial metadata
… with EdgeInterpolation enum.

2. Add LogicalTypeReader cases 17/18 for GEOMETRY/GEOGRAPHY with CRS and edge interpolation parsing.
3. Add geospatialStatistics field (field 7) to ColumnIndex and ColumnIndexReader.
4. Add IntersectsPredicate to FilterPredicate with intersects() factory method.
5. Add GeospatialPredicate to ResolvedPredicate.
6. Add geospatial case to FilterPredicateResolver with GEOMETRY/GEOGRAPHY validation.
7. Add row group bounding box evaluation in RowGroupFilterEvaluator with antimeridian wrapping.
8. Add page-level bounding box based filter evaluation in PageFilterEvaluator.
9. Add Geospatial utility class for shared x-axis overlap logic.
10. Add GeospatialEndToEndTest for full filter pushdown chain with JTS WKB decoding.
11. Add unit tests for spatial predicate evaluation including antimeridian and and/or composition.
12. Add geo-datagen.py for geospatial test data generation.
13. Update usage.md with geospatial column identification and intersects filter pushdown examples.
@gunnarmorling

Copy link
Copy Markdown
Collaborator

Thanks a lot, @mghildiy! I've applied some fixes to resolve a few loose ends, the result is #413, superseding this PR. Gonna close the one here and merge the other one, it retains your authorship.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants