From c43b83fca455ad4ea2abb87b8845eea4aa3fc287 Mon Sep 17 00:00:00 2001 From: Mayur Bhosale Date: Wed, 11 Jul 2018 13:03:41 +0530 Subject: [PATCH] Revert "added unique priority queue implementation based on the implementation in spark" This reverts commit f74a2715b0afa8d4f2ddf6d24de5cd20cd4085e3. --- .../spatialOperator/SpatialQuery.scala | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/main/scala/com/spark3d/spatialOperator/SpatialQuery.scala b/src/main/scala/com/spark3d/spatialOperator/SpatialQuery.scala index 936f6f5..9cbd8c7 100644 --- a/src/main/scala/com/spark3d/spatialOperator/SpatialQuery.scala +++ b/src/main/scala/com/spark3d/spatialOperator/SpatialQuery.scala @@ -18,7 +18,6 @@ package com.astrolabsoftware.spark3d.spatialOperator import com.astrolabsoftware.spark3d.geometryObjects.Shape3D.Shape3D import com.astrolabsoftware.spark3d.utils.GeometryObjectComparator -import com.astrolabsoftware.spark3d.utils.BoundedUniquePriorityQueue import org.apache.spark.rdd.RDD import com.astrolabsoftware.spark3d.spatialPartitioning._ @@ -26,7 +25,6 @@ import scala.collection.mutable import scala.collection.mutable.{HashSet, ListBuffer, PriorityQueue} import scala.reflect.ClassTag import scala.util.control.Breaks._ -import org.apache.spark.util.collection.{Utils => collectionUtils} object SpatialQuery { @@ -125,30 +123,4 @@ object SpatialQuery { } knn_f.toList } - - private def takeOrdered[A <: Shape3D: ClassTag](rdd: RDD[A], num: Int, queryObject: A, unique: Boolean = false)(implicit ord: Ordering[A]): Array[A] = { - - if (unique) { - if (num == 0) { - Array.empty - } else { - val mapRDDs = rdd.mapPartitions { items => - val queue = new BoundedUniquePriorityQueue[A](num)(ord.reverse) - queue ++= collectionUtils.takeOrdered(items, num)(ord) - Iterator.single(queue) - } - if (mapRDDs.partitions.length == 0) { - Array.empty - } else { - mapRDDs.reduce { (queue1, queue2) => - queue1 ++= queue2 - queue1 - }.toArray.sorted(ord) - } - } - - } - - return rdd.takeOrdered(num)(new GeometryObjectComparator[A](queryObject.center)) - } }