james-willis opened a new pull request, #1221:
URL: https://github.com/apache/sedona-db/pull/1221

   Closes DB-384.
   
   Adds `RS_GeoTransform`, the composite geotransform accessor, to 
`sedona-raster-functions`. The individual component accessors (`RS_ScaleX/Y`, 
`RS_SkewX/Y`, `RS_UpperLeftX/Y`, `RS_Rotation`) already lived in 
`rs_geotransform.rs`; this returns the decomposition Sedona Spark reports: a 
struct of `magnitudeI`, `magnitudeJ`, `thetaI`, `thetaIJ`, `offsetX`, `offsetY` 
(six non-nullable Float64 fields, matching Spark's schema and field names).
   
   The decomposition math mirrors Sedona Spark's 
`RasterAccessors#getGeoTransform` exactly, including the two `acos` sign tests, 
since Spark is the parity target. One consequence worth noting for reviewers: 
Spark's `thetaI` only agrees with our existing `RS_Rotation` (`atan2(-skewX, 
scaleX)`) when `|skewX| == |skewY|` — i.e. they agree for north-up and 
rigidly-rotated rasters but diverge under shear. That existing `RS_Rotation` 
divergence from Spark is not touched here.
   
   - Rust: `RsGeoTransformComposite` kernel + `rs_geotransform_udf`, registered 
in `register.rs`. Null rasters produce null struct rows.
   - Unit tests: a north-up raster and a 3-4-5 skewed raster chosen so every 
expected component is exactly representable (magnitudes are roots of perfect 
squares; `acos` inputs land on -1, 0, 0.6, 0.8, 1), plus a null row.
   - Python: `test_rs_geotransform` asserts the `RS_Example()` decomposition.
   - Docs: `docs/reference/sql/rs_geotransform.qmd`.
   - Spark parity: two new cases in 
`integration/spark-parity/test_rs_scalar.py` — north-up (anchored to 
hand-derived exact values) and 3-4-5 skew (exercises both sign tests), per the 
parity-harness-per-function plan for the RS_ parity project.
   - Harness: `result_to_tuples` now passes struct columns through as dicts 
(they can't be cast to string), the same treatment list columns already get.
   
   ## Testing
   
   - `cargo test -p sedona-raster-functions rs_geotransform`
   - `pytest python/sedonadb/tests/functions/test_raster_functions.py -k 
geotransform`
   - `pytest integration/spark-parity/test_rs_scalar.py` (full file, JDK 17 / 
pyspark 4.1)
   


-- 
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]

Reply via email to