Abeeujah commented on code in PR #431:
URL: https://github.com/apache/sedona-db/pull/431#discussion_r2611274553


##########
rust/sedona-geo/src/st_concavehull.rs:
##########
@@ -0,0 +1,270 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#![allow(dead_code)]
+use std::sync::Arc;
+
+use arrow_array::builder::BinaryBuilder;
+use datafusion_common::error::Result;
+use datafusion_common::ScalarValue;
+use datafusion_common::{
+    cast::{as_boolean_array, as_float64_array},
+    DataFusionError,
+};
+use datafusion_expr::ColumnarValue;
+use geo::{ConcaveHull, CoordsIter};
+use geo_traits::{GeometryCollectionTrait, GeometryTrait, PointTrait};
+use sedona_expr::scalar_udf::{ScalarKernelRef, SedonaScalarKernel};
+use sedona_geometry::wkb_factory::{
+    write_wkb_coord_trait, write_wkb_empty_point, write_wkb_point_header, 
WKB_MIN_PROBABLE_BYTES,
+};
+use sedona_schema::datatypes::SedonaType;
+use sedona_schema::{datatypes::WKB_GEOMETRY, matchers::ArgMatcher};
+use wkb::writer::WriteOptions;
+
+use crate::to_geo::GeoTypesExecutor;
+
+/// ST_ConcaveHull implementation using [ConcaveHull]
+pub fn st_concavehull_impl() -> ScalarKernelRef {
+    Arc::new(STConcaveHull {})
+}
+
+#[derive(Debug)]
+struct STConcaveHull {}
+
+impl SedonaScalarKernel for STConcaveHull {
+    fn return_type(&self, args: &[SedonaType]) -> Result<Option<SedonaType>> {
+        let matcher = ArgMatcher::new(
+            vec![ArgMatcher::is_geometry(), ArgMatcher::is_numeric()],
+            WKB_GEOMETRY,
+        );
+
+        matcher.match_args(args)
+    }
+
+    fn invoke_batch(
+        &self,
+        arg_types: &[SedonaType],
+        args: &[ColumnarValue],
+    ) -> Result<ColumnarValue> {
+        invoke_batch_impl(arg_types, args)
+    }

Review Comment:
   I was working on two kernels, one to accept the optional boolean parameter 
to allow holes and the other that uses the default `false` value for the allow 
holes parameter, that's why I had the `invoke_batch_impl` there.
   
   But this particular library wasn't actually supporting allow holes, so I'd 
just go ahead and inline here.



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