C-Loftus opened a new pull request, #2795:
URL: https://github.com/apache/iceberg-go/pull/2795

   ## Summary
   
   `BBoxIntersects` now prunes row groups using the `GeospatialStatistics` bbox 
in each GEOMETRY column chunk's footer. Before this, only data-file-level 
pruning used geo bounds.
   
   **Why**
   
   arrow-go v18.9.0 already writes `GeoStatistics` for GEOMETRY chunks, and 
iceberg-go's writer produces them. The footer has no min/max Statistics block 
for geo columns, because WKB has no sort order, so the existing row-group 
evaluator found nothing to prune with. The bbox was never read.
   
   **Changes**
   - `table/evaluators.go`: `TestRowGroup` reads 
`ColumnChunkMetaData.GeoStatistics()`. When it is valid and has a bbox, it 
encodes the bbox into the bounds maps that `VisitBBoxIntersects` already reads. 
Chunks with no bbox, invalid statistics, or GEOGRAPHY columns get no bounds and 
are kept.
   - `table/internal/geo_codec.go`: added `EncodeGeoBoundsXY`.
   - `visitors.go`: added `TranslateColumnNamesForPruning`. The scan's 
column-name translation turned bbox predicates into `AlwaysTrue`, so pruning 
never saw them. The new function keeps them for pruning only. The record filter 
is unchanged, because it can't express bbox predicates.
   - `table/arrow_filter_plan.go` and `table/arrow_scanner.go`: both pruning 
paths (cached plan and uncached) use the new translation.
   - Comments: fixed a stale test comment saying arrow-go emits no 
GeoStatistics, and noted in `parquet_files.go` that geometry chunks carry a 
footer bbox.
   
   **Tests**
   
   `TestRowGroupPruningBBoxIntersects` writes one row per row group through the 
real writer. It compiles the filter via `compileFileFilterPlan`, so it covers 
the translation as well as the evaluator, and checks that:
   - A disjoint row group is pruned.
   - A row group that only touches the query box at an edge is kept (closed 
intervals).
   - An all-null row group is kept, because the footer carries no null count to 
prove it empty.
   - Geography is never pruned.
   
   
   **Not in this PR**
   - Geography bbox, at the file level or in the row-group stats. arrow-go 
writes none for geography, and it needs antimeridian and geodesic handling: 
https://github.com/apache/arrow-go/issues/1717
   - Geo bounds for imported files (`AddDataFilesByPath`) from `GeoStatistics`.
   - Row-level `BBoxIntersects` filtering and Substrait conversion.
   - No end-to-end test runs a full table scan with a bbox filter. The tests 
cover plan compilation and row-group evaluation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to