Dissolve Grouped Union Pipeline

Context

GeoDataFrame.dissolve mixes pandas grouping semantics with grouped geometry union. The public contract is groupby-driven, but the geometry core should be stageable as GPU-friendly grouped constructive work later.

Decision

Use a grouped-union pipeline:

  • encode group keys once

  • stable-sort rows by group

  • derive group spans with run-length encode

  • aggregate attributes separately from geometry

  • union each group independently

  • assemble the final frame at the end

The current host implementation now routes through this pipeline. Future GPU work should replace the grouped-union stage with a CUDA implementation built on sorting, segmented execution, and compaction primitives rather than redesigning the full public dissolve surface.

Consequences

  • Public dissolve behavior stays aligned with upstream pandas and GeoPandas semantics.

  • The geometry core has a clean seam for CUDA and CCCL-driven work later.

  • Deterministic group order is explicit instead of incidental.

  • Device polygon groups now lower through NativeGrouped sorted offsets into one grouped constructive executor; global polygon union is the one-group case.

  • Admitted grouped execution is atomic. Failures do not trigger a host-shaped tree reduction, pairwise retry, or Shapely re-execution.

Alternatives Considered

  • keep dissolve as a pure pandas groupby callback around union_all

  • global union followed by post-hoc regrouping

  • a geometry-only pipeline that ignores pandas aggregation boundaries

Acceptance Notes

The implementation exposes a dissolve planner, native grouped union executor, benchmark surface, and repo-owned GeoDataFrame.dissolve path. Host CSR group metadata lowers once; device grouped metadata remains resident through output.