1414// KIND, either express or implied. See the License for the
1515// specific language governing permissions and limitations
1616// under the License.
17- use datafusion_expr:: { scalar_doc_sections:: DOC_SECTION_OTHER , Documentation , Volatility } ;
18- use sedona_expr:: scalar_udf:: SedonaScalarUDF ;
17+ use std:: sync:: Arc ;
18+
19+ use arrow_schema:: DataType ;
20+ use datafusion_common:: plan_err;
21+ use sedona_expr:: scalar_udf:: { SedonaScalarUDF , SimpleSedonaScalarKernel } ;
1922use sedona_schema:: { datatypes:: SedonaType , matchers:: ArgMatcher } ;
2023
21- /// ST_Relate() scalar UDF implementation
24+ /// ST_Relate() scalar UDF stub
2225pub fn st_relate_udf ( ) -> SedonaScalarUDF {
23- SedonaScalarUDF :: from_impl (
24- "st_relate" ,
26+ let stub_impl = SimpleSedonaScalarKernel :: new_ref (
2527 ArgMatcher :: new (
2628 vec ! [ ArgMatcher :: is_geometry( ) , ArgMatcher :: is_geometry( ) ] ,
27- SedonaType :: Arrow ( arrow_schema :: DataType :: Utf8 ) ,
29+ SedonaType :: Arrow ( DataType :: Utf8 ) ,
2830 ) ,
29- Volatility :: Immutable ,
30- Some ( st_relate_doc ( ) ) ,
31- )
31+ Arc :: new ( |_arg_types , _args| plan_err ! ( "ST_Relate() is not yet implemented" ) ) ,
32+ ) ;
33+ SedonaScalarUDF :: from_impl ( "st_relate" , stub_impl )
3234}
3335
34- fn st_relate_doc ( ) -> Documentation {
35- Documentation :: builder (
36- DOC_SECTION_OTHER ,
37- "Returns the DE-9IM intersection matrix for two geometries" ,
38- "ST_Relate (geomA: Geometry, geomB: Geometry)" ,
39- )
40- . with_argument ( "geomA" , "First input geometry" )
41- . with_argument ( "geomB" , "Second input geometry" )
42- . with_sql_example (
43- "SELECT ST_Relate(
44- ST_GeomFromWKT('POINT(0 0)'),
45- ST_GeomFromWKT('POINT(1 1)')
46- )" ,
47- )
48- . build ( )
49- }
36+ #[ cfg( test) ]
37+ mod tests {
38+ use datafusion_expr:: ScalarUDF ;
39+
40+ use super :: * ;
41+
42+ #[ test]
43+ fn udf_metadata ( ) {
44+ let udf: ScalarUDF = st_relate_udf ( ) . into ( ) ;
45+ assert_eq ! ( udf. name( ) , "st_relate" ) ;
46+ }
47+ }
0 commit comments