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


##########
rust/sedona-raster-functions/src/rs_example.rs:
##########
@@ -116,23 +114,19 @@ mod tests {
         let arg_types = vec![];
 
         let result = kernel.invoke_batch(&arg_types, &args).unwrap();
-        if let ColumnarValue::Scalar(ScalarValue::Struct(arc_struct)) = result 
{
-            let raster_array = 
RasterStructArray::try_new(arc_struct.as_ref()).unwrap();
-
-            assert_eq!(raster_array.len(), 1);
-            let raster = raster_array.get(0).unwrap();
-            let metadata = raster.metadata();
-            assert_eq!(metadata.width(), 64);
-            assert_eq!(metadata.height(), 32);
-
-            let bands = raster.bands();
-            let band = bands.band(1).unwrap();
-            let band_metadata = band.metadata();
-            assert_eq!(band_metadata.data_type().unwrap(), 
BandDataType::UInt8);
-            assert_eq!(band_metadata.nodata_value(), Some(&[127u8][..]));
-            assert_eq!(band_metadata.storage_type().unwrap(), 
StorageType::InDb);
-        } else {
+        let ColumnarValue::Scalar(scalar) = result else {
             panic!("Expected scalar struct result");
+        };
+
+        // RS_Example builds a 64x32, 3-band UInt8 raster with origin
+        // (43.08, 79.07), scale 2, skew 1, nodata 127. Every pixel of band N
+        // is N except the top-left corner, which is set to the nodata value.
+        let mut expected = RasterSpec::d2(64, 32).transform([43.08, 2.0, 1.0, 
79.07, 1.0, 2.0]);

Review Comment:
   I added a bbox method - it didnt actually exist. 
   
   but this is important here, two reasons:
   
   1. we are asserting that RS_Example has stable behavior - ie it has the same 
geotransform that we expect. So why add indirection to that with a bbox
   2. RS_Example has a geotransform with skew so we CANNOT use a bbox to 
represent it.



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