tanmayrauth opened a new pull request, #1597:
URL: https://github.com/apache/iceberg-go/pull/1597
Summary
Adds geospatial BBoxIntersects / BBoxNotIntersects predicates and wires
them through the bound-expression visitor so data files whose geometry bounds
cannot overlap a query bounding box are pruned during scan planning. Reuses the
single-value geo bound codec from #993.
What changed
- New predicate (exprs.go) — BoundingBox (planar XY box with Valid/Equals)
and the BBoxIntersects(term, bbox) constructor producing an UnboundPredicate.
Binding rejects non-geo columns (ErrType) and transform terms; the constructor
panics on a nil term or an invalid box (NaN / inverted min-max) to prevent
silent mis-pruning. Adds OpBBoxIntersects / OpBBoxNotIntersects (kept after the
boolean ops so existing op-group ranges are undisturbed) with negation and
String() support.
- Visitor interface (visitors.go) — adds VisitBBoxIntersects /
VisitBBoxNotIntersects to BoundBooleanExprVisitor, dispatches them in
VisitBoundPredicate, and collapses bbox predicates to AlwaysTrue in the
sanitize visitor (they carry query-box coordinates, not user literals, and have
no REST JSON form). The row-level exprEvaluator conservatively keeps every row
— full ST_Intersects remains a query-engine
concern.
- Data-file pruning (table/evaluators.go) —
inclusiveMetricsEval.VisitBBoxIntersects prunes files whose decoded geometry
bounds are disjoint from the query box (all-null files also prune). Geography
columns are never pruned (geodesic bounds may cross the antimeridian).
BBoxNotIntersects, strict eval, manifest eval, and the bloom collector all
conservatively keep files, since bounds alone can't answer them.
- Codec helpers (table/internal/geo_codec.go) — GeoBoundsXY decodes
lower/upper bounds to planar extents (fails safe on missing/malformed/NaN), and
BBoxIntersectsXY does the closed-interval overlap test.
- Serialization guards — bbox predicates return an error from MarshalJSON
(no REST grammar) and panic in the substrait converter, since they exist only
for local scan planning.
Testing
expr_bbox_test.go, table/evaluators_geo_test.go,
table/internal/geo_codec_internal_test.go, and additions to visitors_test.go
cover construction/validation, binding, pruning decisions (geometry vs
geography, null-only, malformed bounds), and codec edge cases.
Closes: #994
--
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]