james-willis opened a new pull request, #3312: URL: https://github.com/apache/sedona/pull/3312
## Did you read the Contributor Guide? - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/) ## Is this PR related to a ticket? - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #3311 ## What changes were proposed in this PR? The docs and the common Java implementation say a `null` `noDataValue` removes the band's no-data value, but from Spark SQL that path was unreachable: the catalyst expression wrapped `RasterBandEditors.setBandNoDataValue` with `inferrableFunction2/3/4`, which null-propagate as soon as any argument is null, so `RS_SetBandNoDataValue(raster, 1, NULL)` returned a NULL raster instead. Fixing this matches PostGIS `ST_SetBandNoDataValue` NULL-clears semantics and the behavior SedonaDB adopted in apache/sedona-db#1158. - Added `InferrableFunction.allowRightNull3`, an arity-3 counterpart of the existing `allowRightNull` pattern (allows the third argument to be null; still null-propagates when the raster or band index is null). It is a separate name rather than an overload because overloading `allowRightNull` breaks eta-expansion of the overloaded functions passed to it at existing call sites. - Wired the 2- and 3-argument overloads of `RS_SetBandNoDataValue` through `allowRightNull`/`allowRightNull3`. The 4-argument `replace` overload still null-propagates, since replacing pixels with a null no-data value is meaningless; the docs now note that clearing requires the 2-/3-argument form. - Documented the clearing behavior with an example in `RS_SetBandNoDataValue.md`. ## How was this patch tested? Strengthened the existing `RS_SetBandNoDataValue` test in `rasteralgebraTest.scala` so it distinguishes clearing from null-propagation: it sets a no-data value, clears it with NULL (both the 2- and 3-argument forms), and asserts the resulting raster is non-null while `RS_BandNoDataValue` on it is null; it also asserts a NULL raster input still yields NULL. Before this change the previous test passed under both semantics because `RS_BandNoDataValue` returns null for a null raster too. Verified the new assertions fail without the expression change and pass with it (`rasteralgebraTest`, Spark 3.5 / Scala 2.12 / JDK 17). ## Did this PR include necessary documentation updates? - Yes, I have updated the documentation. -- 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]
