You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by GitBox <gi...@apache.org> on 2022/04/17 08:10:51 UTC
[GitHub] [incubator-sedona] jiayuasu commented on a diff in pull request #610: [SEDONA 95] Add ST_Disjoint predicate
jiayuasu commented on code in PR #610:
URL: https://github.com/apache/incubator-sedona/pull/610#discussion_r851720081
##########
sql/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinQueryDetector.scala:
##########
@@ -69,6 +69,8 @@ class JoinQueryDetector(sparkSession: SparkSession) extends Strategy {
Some(JoinQueryDetection(left, right, leftShape, rightShape, false, extraCondition))
case ST_Crosses(Seq(leftShape, rightShape)) =>
Some(JoinQueryDetection(right, left, rightShape, leftShape, false, extraCondition))
+ case ST_Disjoint(Seq(leftShape, rightShape)) =>
+ Some(JoinQueryDetection(left, right, leftShape, rightShape, false, extraCondition))
case _ => None
Review Comment:
Please do NOT make any change to this file because ST_Disjoint-based join in Spark cannot be optimized bySedona.
##########
flink/src/main/java/org/apache/sedona/flink/expressions/Predicates.java:
##########
@@ -104,4 +104,28 @@ public Boolean eval(@DataTypeHint("INT") Integer key, @DataTypeHint(value = "RAW
return JudgementHelper.match(geom1, geom2, halfOpenRectangle, false);
}
}
+
+ public static class ST_Disjoint extends ScalarFunction {
+ private List<Envelope> grids;
+
+ /**
+ * Constructor for duplicate removal
+ */
+ public ST_Disjoint(PartitioningUtils partitioner) {
+ grids = partitioner.fetchLeafZones();
+ }
+
+ /**
+ * Constructor for relation checking without duplicate removal
+ */
+ public ST_Disjoint() {
+ }
+
+ @DataTypeHint("Boolean")
+ public Boolean eval(@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) Object o1, @DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) Object o2) {
+ Geometry geom1 = (Geometry) o1;
Review Comment:
Please also add a test to Flink. Thanks!
--
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: dev-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org