Skip to content

[GH-3372] Allow NaN nodata in RS_AsRaster - #3384

Merged
jiayuasu merged 1 commit into
apache:masterfrom
mtcd001-tech:fix/as-raster-nan-nodata-3372
Sep 22, 2026
Merged

jiayuasu merged 1 commit into
apache:masterfrom
mtcd001-tech:fix/as-raster-nan-nodata-3372

Conversation

@mtcd001-tech

Copy link
Copy Markdown
Contributor

Did you read the Contributor Guide?

Yes, I have read the Contributor Rules and Contributor Development Guide.

Is this PR related to a ticket?

Closes #3372.

What changes were proposed in this PR?

Allow NaN nodata values for float and double output in RS_AsRaster, both when supplied explicitly and when inherited from the reference raster. Preserve rejection for integer pixel types, finite-value checks for burn values, and exact storage checks for finite nodata values.

Infinity remains rejected: GeoTools cannot construct an infinite nodata category bound. This matches the existing infinite-nodata handling in RS_FromGeoTiff. The API documentation now makes this distinction explicit.

How was this patch tested?

On Windows with Java 17:

  • Both new NaN regression tests fail against unchanged upstream production code and pass with the fix. They verify background pixels, nodata metadata, and the count excluding nodata for F/D output.

  • Tests also cover inherited NaN rejection for integer bands, nonfinite integer nodata, infinite floating nodata, and nonfinite burn values.

  • All 128 tests in RasterConstructorsTest, RasterizationTest, RasterBandAccessorsTest, RasterUtilsTest, and SerdeTest pass:

    mvn -pl common -am -Dtest=RasterConstructorsTest,RasterizationTest,RasterBandAccessorsTest,RasterUtilsTest,SerdeTest -Dsurefire.failIfNoSpecifiedTests=false test
  • Including RasterBandEditorsTest gives 146 passing tests and one existing failure in testClip: a Windows line-ending difference in GeoTools text output. The same failure was reproduced against unchanged upstream production code.

  • Spotless and git diff --check pass.

Spark and Python suites were not run locally.

Did this PR include necessary documentation updates?

Yes, the RS_AsRaster documentation describes support for NaN nodata on F/D and the infinity restriction.

@jiayuasu jiayuasu added this to the sedona-2.0.0 milestone Sep 22, 2026

@jiayuasu jiayuasu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jiayuasu
jiayuasu merged commit 86fbb82 into apache:master Sep 22, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RS_AsRaster rejects NaN as a noDataValue on floating point pixel types

2 participants