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


##########
rust/sedona-raster-functions/src/rs_value.rs:
##########
@@ -786,6 +658,74 @@ mod tests {
         assert_eq!(sample("POINT (100 100)"), None); // outside the footprint
     }
 
+    /// A two-band raster used to exercise the default-band ambiguity error.
+    fn two_band_raster() -> StructArray {
+        RasterSpec::d2(2, 2)
+            .band_values(&[1u8, 2, 3, 4])
+            .band_values(&[10u8, 20, 30, 40])
+            .transform([0.0, 1.0, 0.0, 10.0, 0.0, -1.0])
+            .build()
+    }
+
+    #[test]
+    fn default_band_requires_single_band_raster_array_path() {
+        // No band argument + multiband raster is ambiguous -> error (general,
+        // array-raster path) rather than silently sampling band 1.
+        let udf: ScalarUDF = rs_value_udf().into();
+        let geom_type = SedonaType::Wkb(Edges::Planar, lnglat());
+        let tester = ScalarUdfTester::new(udf, vec![RASTER, 
geom_type.clone()]);
+        let geoms = create_geom_array(&[Some("POINT (0.5 9.5)")], &geom_type);
+        let err = tester
+            .invoke_arrays(vec![Arc::new(two_band_raster()), geoms])

Review Comment:
   this test is intentionally testing the array array path, which is a distinct 
code path in this functions.
   
   intentional



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