james-willis commented on code in PR #1028:
URL: https://github.com/apache/sedona-db/pull/1028#discussion_r3590312102


##########
python/sedonadb/tests/functions/test_raster_functions.py:
##########
@@ -292,3 +292,38 @@ def test_rs_asgeotiff_out_of_range_quality_errors(con):
     # silently clamping to maximum quality.
     with pytest.raises(Exception, match="between 0.0 and 1.0"):
         con.sql("SELECT RS_AsGeoTiff(RS_Example(), 'JPEG', 
75)").to_arrow_table()
+
+
+# Cross-check RS_AsGeoTiff against rasterio: export a random raster of each
+# band data type and confirm rasterio decodes the bytes back to the identical
+# array, dtype, and geotransform. The DEFLATE/LZW variants also exercise the
+# per-dtype predictor selection (horizontal differencing for integers,
+# floating-point prediction for float bands).
[email protected]("dtype", ["uint8", "uint16", "int32", "float32", 
"float64"])
[email protected]("compression_args", ["", ", 'DEFLATE', 0.85", ", 
'LZW', 0.85"])
+def test_rs_asgeotiff_roundtrips_contents(con, dtype, compression_args):
+    import numpy as np
+
+    pytest.importorskip("rasterio")
+    from rasterio.io import MemoryFile
+
+    from sedonadb.raster import Raster

Review Comment:
   done



##########
rust/sedona-raster-gdal/src/rs_as_geotiff.rs:
##########
@@ -210,9 +211,13 @@ impl RsAsGeoTiff {
             .create_copy(&driver, &vsi_path, &options_refs)
             .map_err(|e| exec_datafusion_err!("Failed to create GeoTiff: {}", 
e))?;
 
-        // Read bytes from the VSI memory file; the guard cleans up.
+        // Seize the vsimem file's buffer without copying: `VSIBuffer` owns the
+        // GDAL allocation (freed on drop) and unlinks the file, so the only
+        // byte copy left is the append into the output builder. The guard's

Review Comment:
   done



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