james-willis commented on code in PR #1159: URL: https://github.com/apache/sedona-db/pull/1159#discussion_r3874152927
########## python/sedonadb/tests/functions/test_rs_raster_out_spark_parity.py: ########## @@ -0,0 +1,69 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""SedonaDB vs Sedona Spark parity for raster-in / raster-out functions. + +These exercise the raster round-trip *out* of each engine: SedonaDB decodes its +native raster column; Sedona Spark transports the result as GeoTIFF bytes +(`RS_AsGeoTiff`) and decodes it with rasterio. Both sides land as a +`DecodedRaster` (pixels + geotransform + per-band nodata) and are compared with +`assert_decoded_equal`. Same opt-in (`SEDONADB_RUN_SPARK_TESTS`) and +`xfail`-for-known-divergence policy as the scalar suite. + +`RS_SetBandNoDataValue` is the first case on purpose: it is raster-in/raster-out +but passes pixels through untouched, so a mismatch is a round-trip bug, not an +operation divergence — it isolates the transport. Pixel-transforming ops +(RS_Resample, RS_MapAlgebra) come next, with their known divergences as xfails. +""" + +import pytest + +from sedonadb.raster_testing import ( + assert_decoded_equal, + random_raster_data, + write_geotiff, +) +from sedonadb.testing import SedonaDB +from sedonadb.testing_spark import SedonaSpark + +pytest.importorskip("rasterio") # write_geotiff / GeoTIFF decode go through rasterio + +GDAL_TRANSFORM = (100.0, 2.0, 0.0, 500.0, 0.0, -3.0) +BANDS, HEIGHT, WIDTH = 2, 6, 7 + +# Each value is representable in its dtype, so it packs into the band exactly. +BAND_NODATA = {"uint8": 200.0, "int32": -99999.0, "float64": -12345.5} + + [email protected]("dtype", list(BAND_NODATA)) +def test_rs_setbandnodata_raster_out_spark_parity(dtype, tmp_path): Review Comment: Intentionally this is NOT run in the CI. I think it could be a good idea to do so but perhaps running spark in the CI on each PR is a bit heavy. I do not have a strong opinion on this though; perhaps we can wait for Dewey to weigh in. -- 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]
