paleolimbot commented on code in PR #241:
URL: https://github.com/apache/sedona-db/pull/241#discussion_r2467845022
##########
c/sedona-geos/src/st_buffer.rs:
##########
@@ -163,4 +302,198 @@ mod tests {
let envelope_result =
envelope_tester.invoke_array(buffer_result).unwrap();
assert_array_equal(&envelope_result, &expected_envelope);
}
+
+ #[rstest]
+ fn udf_with_buffer_params(#[values(WKB_GEOMETRY, WKB_VIEW_GEOMETRY)]
sedona_type: SedonaType) {
+ let udf = SedonaScalarUDF::from_kernel("st_buffer",
st_buffer_style_impl());
+ let tester = ScalarUdfTester::new(
+ udf.into(),
+ vec![
+ sedona_type.clone(),
+ SedonaType::Arrow(DataType::Float64),
+ SedonaType::Arrow(DataType::Utf8),
+ ],
+ );
+ tester.assert_return_type(WKB_GEOMETRY);
+
+ // Envelope checks result in different values for different GEOS
versions.
+ // This test at least ensures that the buffer parameters are plugged
in.
+ let buffer_result_flat = tester
+ .invoke_scalar_scalar_scalar("LINESTRING (0 0, 10 0)", 2.0,
"endcap=flat".to_string())
+ .unwrap();
+
+ let buffer_result_square = tester
+ .invoke_scalar_scalar_scalar("LINESTRING (0 0, 10 0)", 1.0,
"endcap=square".to_string())
+ .unwrap();
+
+ assert_ne!(buffer_result_flat, buffer_result_square);
Review Comment:
I pushed this to try to get CI passing since I wasn't sure myself exactly
how to do it without trying a few things...I think this is OK given the
integration tests. Buffer is just very hard one to test.
--
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]