Abeeujah commented on code in PR #241:
URL: https://github.com/apache/sedona-db/pull/241#discussion_r2462978252
##########
c/sedona-geos/src/st_buffer.rs:
##########
@@ -41,41 +54,37 @@ struct STBuffer {}
impl SedonaScalarKernel for STBuffer {
fn return_type(&self, args: &[SedonaType]) -> Result<Option<SedonaType>> {
- let matcher = ArgMatcher::new(
- vec![ArgMatcher::is_geometry(), ArgMatcher::is_numeric()],
- WKB_GEOMETRY,
- );
+ if !(2..=4).contains(&args.len()) {
+ return Err(DataFusionError::Plan(format!(
+ "ST_Buffer expects 2-4 arguments, got {}",
+ args.len()
+ )));
+ }
+
+ let mut matchers = vec![ArgMatcher::is_geometry(),
ArgMatcher::is_numeric()];
- matcher.match_args(args)
+ if args.len() >= 3 {
+ matchers.push(ArgMatcher::is_boolean());
+ }
+ if args.len() == 4 {
+ matchers.push(ArgMatcher::is_string());
+ }
+
+ ArgMatcher::new(matchers, WKB_GEOMETRY).match_args(args)
}
fn invoke_batch(
&self,
arg_types: &[SedonaType],
args: &[ColumnarValue],
) -> Result<ColumnarValue> {
- // Default params
- let params_builder = BufferParams::builder();
+ // Extract Args
+ let distance: Option<f64> = extract_optional_f64(&args[1])?;
Review Comment:
I did convert it to an array :sweat_smile: thanks for the vote of
confidence, please do let me know if the implementation is going as expected
--
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]