From d22a7afc7ead03f05057b248bfb3d6d786ef6239 Mon Sep 17 00:00:00 2001 From: Daniel Sparing Date: Thu, 8 Feb 2024 16:52:42 +0100 Subject: [PATCH 1/2] include st_within in python import and scala test --- python/mosaic/api/predicates.py | 2 +- .../labs/mosaic/functions/MosaicContextBehaviors.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/python/mosaic/api/predicates.py b/python/mosaic/api/predicates.py index 39f856597..9291423b8 100644 --- a/python/mosaic/api/predicates.py +++ b/python/mosaic/api/predicates.py @@ -9,7 +9,7 @@ ###################### -__all__ = ["st_intersects", "st_contains"] +__all__ = ["st_intersects", "st_contains", "st_within"] def st_intersects(left_geom: ColumnOrName, right_geom: ColumnOrName) -> Column: diff --git a/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala b/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala index a4afc3a1a..363efc31e 100644 --- a/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala +++ b/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala @@ -105,6 +105,7 @@ trait MosaicContextBehaviors extends MosaicSpatialQueryTest { noException should be thrownBy getFunc("st_perimeter").apply(Seq(multiPolygon.expr)) noException should be thrownBy getFunc("st_distance").apply(Seq(multiPolygon.expr, pointWkt)) noException should be thrownBy getFunc("st_contains").apply(Seq(multiPolygon.expr, pointWkt)) + noException should be thrownBy getFunc("st_within").apply(Seq(multiPolygon.expr, pointWkt)) noException should be thrownBy getFunc("st_translate").apply(Seq(multiPolygon.expr, xLit, yLit)) noException should be thrownBy getFunc("st_scale").apply(Seq(multiPolygon.expr, xLit, yLit)) noException should be thrownBy getFunc("st_rotate").apply(Seq(multiPolygon.expr, xLit, yLit)) From 9e072f1f2742b360c1e0b2750bdb980c41d1929e Mon Sep 17 00:00:00 2001 From: Daniel Sparing Date: Thu, 8 Feb 2024 16:54:23 +0100 Subject: [PATCH 2/2] swap parameters order for better logic --- .../labs/mosaic/functions/MosaicContextBehaviors.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala b/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala index 363efc31e..bbcf44e6a 100644 --- a/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala +++ b/src/test/scala/com/databricks/labs/mosaic/functions/MosaicContextBehaviors.scala @@ -105,7 +105,7 @@ trait MosaicContextBehaviors extends MosaicSpatialQueryTest { noException should be thrownBy getFunc("st_perimeter").apply(Seq(multiPolygon.expr)) noException should be thrownBy getFunc("st_distance").apply(Seq(multiPolygon.expr, pointWkt)) noException should be thrownBy getFunc("st_contains").apply(Seq(multiPolygon.expr, pointWkt)) - noException should be thrownBy getFunc("st_within").apply(Seq(multiPolygon.expr, pointWkt)) + noException should be thrownBy getFunc("st_within").apply(Seq(pointWkt, multiPolygon.expr)) noException should be thrownBy getFunc("st_translate").apply(Seq(multiPolygon.expr, xLit, yLit)) noException should be thrownBy getFunc("st_scale").apply(Seq(multiPolygon.expr, xLit, yLit)) noException should be thrownBy getFunc("st_rotate").apply(Seq(multiPolygon.expr, xLit, yLit))