@@ -253,6 +253,31 @@ void identitiesAreStrictEvenForAdvisoryPredicates() {
253253 () -> new FilterIdentity ("example.filters" , "custom" , 0 ));
254254 }
255255
256+ @ Test
257+ void spatialExpressionsRenderWkbAsGeometry () {
258+ Field geometry = new Field ("geom" , new FieldType (true , new ArrowType .Binary (), null ,
259+ Map .of ("ARROW:extension:name" , "geoarrow.wkb" ,
260+ "ARROW:extension:metadata" , "{}" )), null );
261+ Field literal = new Field ("value_0" , new FieldType (true , new ArrowType .Binary (), null ,
262+ Map .of ("ARROW:extension:name" , "geoarrow.wkb" ,
263+ "ARROW:extension:metadata" , "{}" )), null );
264+ String expression = "{\" node\" :\" call\" ,\" function\" :{"
265+ + "\" namespace\" :\" duckdb.spatial\" ,\" name\" :\" intersects_extent\" ,\" version\" :1},"
266+ + "\" arguments\" :[" + column ("geom" )
267+ + ",{\" node\" :\" literal\" ,\" value_ref\" :0}]}" ;
268+ PushdownFiltersDecoder .Capabilities capabilities = new PushdownFiltersDecoder .Capabilities (
269+ java .util .Set .of (new FilterIdentity ("duckdb.spatial" , "intersects_extent" , 1 )),
270+ java .util .Set .of (), Map .of ());
271+ PushdownFilters filters = PushdownFiltersDecoder .decode (
272+ batch (snapshot (predicate ("spatial" , "required" , expression )),
273+ List .of (literal ), List .of (new byte [] {1 , 2 , (byte ) 0xff })),
274+ new Schema (List .of (geometry )), List .of (), capabilities );
275+
276+ assertEquals (List .of ("st_intersects_extent(\" geom\" , "
277+ + "ST_GeomFromHEXWKB('0102ff'))" ),
278+ filters .expressionPredicates ());
279+ }
280+
256281 @ Test
257282 void configuredLimitsAndFullUint64RevisionsAreEnforced () {
258283 String longId = "x" .repeat (129 );
0 commit comments