jiayuasu commented on code in PR #609:
URL: https://github.com/apache/incubator-sedona/pull/609#discussion_r855462337


##########
core/src/main/java/org/apache/sedona/core/spatialOperator/DBScanQuery.java:
##########
@@ -0,0 +1,31 @@
+package org.apache.sedona.core.spatialOperator;
+
+import org.apache.sedona.core.dbscanJudgement.DBScanJudgement;
+import org.apache.sedona.core.knnJudgement.GeometryDistanceComparator;
+import org.apache.sedona.core.knnJudgement.KnnJudgementUsingIndex;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.locationtech.jts.geom.Geometry;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+
+public class DBScanQuery
+        implements Serializable
+{
+    public static <T extends Geometry> List<Integer> 
SpatialDBScanQuery(SpatialRDD<T> spatialRDD, double eps, int minPoints, boolean 
useIndex)
+    {
+        if (useIndex) {
+            if (spatialRDD.indexedRawRDD == null) {
+                throw new NullPointerException("Need to invoke buildIndex() 
first, indexedRDDNoId is null");
+            }
+            JavaRDD<Integer> result = 
spatialRDD.getRawSpatialRDD().repartition(1).mapPartitions(new 
DBScanJudgement(eps, minPoints, new HashSet<>()), true);

Review Comment:
   If your implementation cannot work on multiple partitions, then this PR will 
NOT be accepted. We are looking for a distributed DBScan algorithm. For 
example, this one: https://github.com/irvingc/dbscan-on-spark
   
   You can incorporate this library into Sedona since this one is also under 
Apache 2.0 License



-- 
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-unsubscr...@sedona.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to