This is an automated email from the ASF dual-hosted git repository. jiayu pushed a commit to branch fix-lonlat-order in repository https://gitbox.apache.org/repos/asf/sedona.git
commit fcd9a480d16d2cd874f4fefae2f3cc24f75c4768 Author: Jia Yu <[email protected]> AuthorDate: Tue Aug 8 01:10:38 2023 -0700 Drop rarely used constructors in Java --- .../sedona/core/spatialRDD/LineStringRDD.java | 392 +-------------------- .../apache/sedona/core/spatialRDD/PointRDD.java | 379 +------------------- .../apache/sedona/core/spatialRDD/PolygonRDD.java | 384 +------------------- .../sedona/core/spatialRDD/RectangleRDD.java | 388 -------------------- .../apache/sedona/core/io/EarthdataHDFTest.java | 4 +- .../JoinQueryCorrectnessChecker.java | 48 +-- .../sedona/core/spatialOperator/JoinTestBase.java | 8 +- .../core/spatialOperator/LineStringKnnTest.java | 2 +- .../core/spatialOperator/LineStringRangeTest.java | 6 +- .../sedona/core/spatialOperator/PointKnnTest.java | 2 +- .../core/spatialOperator/PointRangeTest.java | 2 +- .../core/spatialOperator/PolygonKnnTest.java | 2 +- .../core/spatialOperator/PolygonRangeTest.java | 6 +- .../core/spatialOperator/RectangleKnnTest.java | 2 +- .../core/spatialOperator/RectangleRangeTest.java | 8 +- .../sedona/core/spatialRDD/GeometryOpTest.java | 2 +- .../sedona/core/spatialRDD/LineStringRDDTest.java | 12 +- .../sedona/core/spatialRDD/PointRDDTest.java | 10 +- .../sedona/core/spatialRDD/PolygonRDDTest.java | 18 +- .../sedona/core/spatialRDD/RectangleRDDTest.java | 8 +- .../core/spatialRDD/SpatialRDDWriterTest.java | 16 +- .../sedona/core/utils/CRSTransformationTest.java | 148 +------- .../scala/org/apache/sedona/core/scalaTest.scala | 19 +- 23 files changed, 96 insertions(+), 1770 deletions(-) diff --git a/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java index 48650ad2..4131569a 100644 --- a/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java +++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java @@ -25,8 +25,6 @@ import org.apache.sedona.core.formatMapper.LineStringFormatMapper; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; -import org.apache.spark.storage.StorageLevel; -import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.LineString; // TODO: Auto-generated Javadoc @@ -52,35 +50,6 @@ public class LineStringRDD this.rawSpatialRDD = rawSpatialRDD; } - /** - * Instantiates a new line string RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaRDD<LineString> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, null, null, null); - } - /** * Instantiates a new line string RDD. * @@ -93,7 +62,7 @@ public class LineStringRDD */ public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null); } /** @@ -107,7 +76,7 @@ public class LineStringRDD */ public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, null, null, null); + this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions); } /** @@ -120,7 +89,7 @@ public class LineStringRDD */ public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, null, null, splitter, carryInputData); } /** @@ -148,265 +117,6 @@ public class LineStringRDD this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); } - /** - * Instantiates a new line string RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaRDD<LineString> rawSpatialRDD, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaRDD<LineString> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new line string RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - */ - public LineStringRDD(JavaRDD<LineString> rawSpatialRDD, StorageLevel newLevel) - { - this.rawSpatialRDD = rawSpatialRDD; - this.analyze(newLevel); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new line string RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaRDD<LineString> rawSpatialRDD, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - /** * Instantiates a new line string RDD. * @@ -417,12 +127,8 @@ public class LineStringRDD * @param splitter the splitter * @param carryInputData the carry input data * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) + public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { JavaRDD rawTextRDD = partitions != null ? sparkContext.textFile(InputLocation, partitions) : sparkContext.textFile(InputLocation); if (startOffset != null && endOffset != null) { @@ -431,96 +137,6 @@ public class LineStringRDD else { this.setRawSpatialRDD(rawTextRDD.mapPartitions(new LineStringFormatMapper(splitter, carryInputData))); } - if (sourceEpsgCRSCode != null && targetEpsgCode != null) { this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode);} - if (newLevel != null) { this.analyze(newLevel);} if (splitter.equals(FileDataSplitter.GEOJSON)) { this.fieldNames = FormatMapper.readGeoJsonPropertyNames(rawTextRDD.take(1).get(0).toString()); } } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new line string RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public LineStringRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } } diff --git a/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java index ca4c560c..9e5bc9d6 100644 --- a/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java +++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java @@ -54,34 +54,6 @@ public class PointRDD this.rawSpatialRDD = rawSpatialRDD; } - /** - * Instantiates a new point RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaRDD<Point> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, partitions, null, null, null); - } - /** * Instantiates a new point RDD. * @@ -93,7 +65,7 @@ public class PointRDD */ public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, Offset, splitter, carryInputData, null); } /** @@ -107,7 +79,7 @@ public class PointRDD */ public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { - this(sparkContext, InputLocation, null, splitter, carryInputData, partitions, null, null, null); + this(sparkContext, InputLocation, null, splitter, carryInputData, partitions); } /** @@ -120,7 +92,7 @@ public class PointRDD */ public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, null, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, null, splitter, carryInputData, null); } /** @@ -148,258 +120,6 @@ public class PointRDD this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); } - /** - * Instantiates a new point RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaRDD<Point> rawSpatialRDD, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaRDD<Point> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, partitions, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, null, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, partitions, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, null, null, null, null); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new point RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - */ - public PointRDD(JavaRDD<Point> rawSpatialRDD, StorageLevel newLevel) - { - this.rawSpatialRDD = rawSpatialRDD; - this.analyze(newLevel); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new point RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaRDD<Point> rawSpatialRDD, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - /** * Instantiates a new point RDD. * @@ -409,103 +129,12 @@ public class PointRDD * @param splitter the splitter * @param carryInputData the carry input data * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, - boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) + public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { JavaRDD rawTextRDD = partitions != null ? sparkContext.textFile(InputLocation, partitions) : sparkContext.textFile(InputLocation); if (Offset != null) {this.setRawSpatialRDD(rawTextRDD.mapPartitions(new PointFormatMapper(Offset, splitter, carryInputData)));} else {this.setRawSpatialRDD(rawTextRDD.mapPartitions(new PointFormatMapper(splitter, carryInputData)));} - if (sourceEpsgCRSCode != null && targetEpsgCode != null) { this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode);} - if (newLevel != null) { this.analyze(newLevel);} if (splitter.equals(FileDataSplitter.GEOJSON)) { this.fieldNames = FormatMapper.readGeoJsonPropertyNames(rawTextRDD.take(1).get(0).toString()); } } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, - boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, Offset, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, - Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, partitions, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, - StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, - StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, false, partitions, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new point RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PointRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, false, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } } diff --git a/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java index c85c510c..097d7c1a 100644 --- a/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java +++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java @@ -62,35 +62,6 @@ public class PolygonRDD this.rawSpatialRDD = rawSpatialRDD; } - /** - * Instantiates a new polygon RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaRDD<Polygon> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, null, null, null); - } - /** * Instantiates a new polygon RDD. * @@ -103,7 +74,7 @@ public class PolygonRDD */ public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null); } /** @@ -117,7 +88,7 @@ public class PolygonRDD */ public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, null, null, null); + this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions); } /** @@ -130,7 +101,7 @@ public class PolygonRDD */ public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData) { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, null, null, null); + this(sparkContext, InputLocation, null, null, splitter, carryInputData, null); } /** @@ -158,258 +129,6 @@ public class PolygonRDD this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); } - /** - * Instantiates a new polygon RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaRDD<Polygon> rawSpatialRDD, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new polygon RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaRDD<Polygon> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, null, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, null, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, null, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, null, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new polygon RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - */ - public PolygonRDD(JavaRDD<Polygon> rawSpatialRDD, StorageLevel newLevel) - { - this.rawSpatialRDD = rawSpatialRDD; - this.analyze(newLevel); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, newLevel, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, newLevel, null, null); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new polygon RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaRDD<Polygon> rawSpatialRDD, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - /** * Instantiates a new polygon RDD. * @@ -420,12 +139,8 @@ public class PolygonRDD * @param splitter the splitter * @param carryInputData the carry input data * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) + public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, FileDataSplitter splitter, boolean carryInputData, Integer partitions) { JavaRDD rawTextRDD = partitions != null ? sparkContext.textFile(InputLocation, partitions) : sparkContext.textFile(InputLocation); if (startOffset != null && endOffset != null) { @@ -434,100 +149,9 @@ public class PolygonRDD else { this.setRawSpatialRDD(rawTextRDD.mapPartitions(new PolygonFormatMapper(splitter, carryInputData))); } - if (sourceEpsgCRSCode != null && targetEpsgCode != null) { this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode);} - if (newLevel != null) { this.analyze(newLevel);} if (splitter.equals(FileDataSplitter.GEOJSON)) { this.fieldNames = FormatMapper.readGeoJsonPropertyNames(rawTextRDD.take(1).get(0).toString()); } } - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param startOffset the start offset - * @param endOffset the end offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer startOffset, Integer endOffset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, startOffset, endOffset, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, partitions, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this(sparkContext, InputLocation, null, null, splitter, carryInputData, null, newLevel, sourceEpsgCRSCode, targetEpsgCode); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new polygon RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public PolygonRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - /** * Polygon union. * diff --git a/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java index 2e247a37..253e7e6d 100644 --- a/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java +++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java @@ -52,19 +52,6 @@ public class RectangleRDD this.rawSpatialRDD = rawSpatialRDD; } - /** - * Instantiates a new rectangle RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaRDD<Polygon> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - } - /** * Instantiates a new rectangle RDD. * @@ -145,379 +132,4 @@ public class RectangleRDD { this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); } - - /** - * Instantiates a new rectangle RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaRDD<Polygon> rawSpatialRDD, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaRDD<Polygon> rawSpatialRDD, String sourceEpsgCRSCode, String targetEpsgCode, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(Offset, splitter, carryInputData))); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(Offset, splitter, carryInputData))); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Integer partitions, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, FileDataSplitter splitter, boolean carryInputData, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param datasetBoundary the dataset boundary - * @param approximateTotalCount the approximate total count - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, Envelope datasetBoundary, Integer approximateTotalCount) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.boundaryEnvelope = datasetBoundary; - this.approximateTotalCount = approximateTotalCount; - } - - /** - * Instantiates a new rectangle RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - */ - public RectangleRDD(JavaRDD<Polygon> rawSpatialRDD, StorageLevel newLevel) - { - this.rawSpatialRDD = rawSpatialRDD; - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(Offset, splitter, carryInputData))); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(Offset, splitter, carryInputData))); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param rawSpatialRDD the raw spatial RDD - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaRDD<Polygon> rawSpatialRDD, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.rawSpatialRDD = rawSpatialRDD; - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param Offset the offset - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer Offset, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(Offset, splitter, carryInputData))); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param partitions the partitions - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, Integer partitions, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param splitter the splitter - * @param carryInputData the carry input data - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, - FileDataSplitter splitter, boolean carryInputData, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(new RectangleFormatMapper(splitter, carryInputData))); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param partitions the partitions - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, Integer partitions, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation, partitions).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } - - /** - * Instantiates a new rectangle RDD. - * - * @param sparkContext the spark context - * @param InputLocation the input location - * @param userSuppliedMapper the user supplied mapper - * @param newLevel the new level - * @param sourceEpsgCRSCode the source epsg CRS code - * @param targetEpsgCode the target epsg code - */ - public RectangleRDD(JavaSparkContext sparkContext, String InputLocation, FlatMapFunction userSuppliedMapper, StorageLevel newLevel, String sourceEpsgCRSCode, String targetEpsgCode) - { - this.setRawSpatialRDD(sparkContext.textFile(InputLocation).mapPartitions(userSuppliedMapper)); - this.CRSTransform(sourceEpsgCRSCode, targetEpsgCode); - this.analyze(newLevel); - } } diff --git a/core/src/test/java/org/apache/sedona/core/io/EarthdataHDFTest.java b/core/src/test/java/org/apache/sedona/core/io/EarthdataHDFTest.java index b0d7c36e..1030d55a 100644 --- a/core/src/test/java/org/apache/sedona/core/io/EarthdataHDFTest.java +++ b/core/src/test/java/org/apache/sedona/core/io/EarthdataHDFTest.java @@ -150,7 +150,7 @@ public class EarthdataHDFTest { EarthdataHDFPointMapper earthdataHDFPoint = new EarthdataHDFPointMapper(HDFincrement, HDFoffset, HDFrootGroupName, HDFDataVariableList, HDFDataVariableName, urlPrefix); - PointRDD spatialRDD = new PointRDD(sc, InputLocation, numPartitions, earthdataHDFPoint, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, numPartitions, earthdataHDFPoint); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); assert resultSize > -1; @@ -168,7 +168,7 @@ public class EarthdataHDFTest { EarthdataHDFPointMapper earthdataHDFPoint = new EarthdataHDFPointMapper(HDFincrement, HDFoffset, HDFrootGroupName, HDFDataVariableList, HDFDataVariableName, urlPrefix); - PointRDD spatialRDD = new PointRDD(sc, InputLocation, numPartitions, earthdataHDFPoint, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, numPartitions, earthdataHDFPoint); spatialRDD.buildIndex(IndexType.RTREE, false); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).count(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinQueryCorrectnessChecker.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinQueryCorrectnessChecker.java index 9959f31c..11b5fe52 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinQueryCorrectnessChecker.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinQueryCorrectnessChecker.java @@ -242,8 +242,8 @@ public class JoinQueryCorrectnessChecker public void testInsidePointJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PointRDD objectRDD = new PointRDD(sc.parallelize(testInsidePointSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PointRDD objectRDD = new PointRDD(sc.parallelize(testInsidePointSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Point>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -262,8 +262,8 @@ public class JoinQueryCorrectnessChecker public void testOnBoundaryPointJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PointRDD objectRDD = new PointRDD(sc.parallelize(testOnBoundaryPointSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PointRDD objectRDD = new PointRDD(sc.parallelize(testOnBoundaryPointSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Point>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -282,8 +282,8 @@ public class JoinQueryCorrectnessChecker public void testOutsidePointJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PointRDD objectRDD = new PointRDD(sc.parallelize(testOutsidePointSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PointRDD objectRDD = new PointRDD(sc.parallelize(testOutsidePointSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Point>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -302,8 +302,8 @@ public class JoinQueryCorrectnessChecker public void testInsideLineStringJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testInsideLineStringSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testInsideLineStringSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<LineString>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -322,8 +322,8 @@ public class JoinQueryCorrectnessChecker public void testOverlappedLineStringJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testOverlappedLineStringSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testOverlappedLineStringSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<LineString>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, true).collect(); @@ -342,8 +342,8 @@ public class JoinQueryCorrectnessChecker public void testOutsideLineStringJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testOutsideLineStringSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + LineStringRDD objectRDD = new LineStringRDD(sc.parallelize(testOutsideLineStringSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<LineString>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -362,8 +362,8 @@ public class JoinQueryCorrectnessChecker public void testInsidePolygonJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testInsidePolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testInsidePolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Polygon>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -382,8 +382,8 @@ public class JoinQueryCorrectnessChecker public void testOverlappedPolygonJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOverlappedPolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOverlappedPolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Polygon>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, true).collect(); @@ -426,8 +426,8 @@ public class JoinQueryCorrectnessChecker public void testOutsidePolygonJoinCorrectness() throws Exception { - PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOutsidePolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD windowRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOutsidePolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Polygon, List<Polygon>>> result = JoinQuery.SpatialJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -446,9 +446,9 @@ public class JoinQueryCorrectnessChecker public void testInsidePolygonDistanceJoinCorrectness() throws Exception { - PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); CircleRDD windowRDD = new CircleRDD(centerGeometryRDD, 0.1); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testInsidePolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testInsidePolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Geometry, List<Polygon>>> result = JoinQuery.DistanceJoinQuery(objectRDD, windowRDD, true, false).collect(); @@ -467,9 +467,9 @@ public class JoinQueryCorrectnessChecker public void testOverlappedPolygonDistanceJoinCorrectness() throws Exception { - PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); CircleRDD windowRDD = new CircleRDD(centerGeometryRDD, 0.1); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOverlappedPolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOverlappedPolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Geometry, List<Polygon>>> result = JoinQuery.DistanceJoinQuery(objectRDD, windowRDD, true, true).collect(); @@ -488,9 +488,9 @@ public class JoinQueryCorrectnessChecker public void testOutsidePolygonDistanceJoinCorrectness() throws Exception { - PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD centerGeometryRDD = new PolygonRDD(sc.parallelize(testPolygonWindowSet)); CircleRDD windowRDD = new CircleRDD(centerGeometryRDD, 0.1); - PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOutsidePolygonSet), StorageLevel.MEMORY_ONLY()); + PolygonRDD objectRDD = new PolygonRDD(sc.parallelize(testOutsidePolygonSet)); prepareRDDs(objectRDD, windowRDD); List<Tuple2<Geometry, List<Polygon>>> result = JoinQuery.DistanceJoinQuery(objectRDD, windowRDD, true, true).collect(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinTestBase.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinTestBase.java index 2f9dd551..0ee7e0c2 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinTestBase.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/JoinTestBase.java @@ -131,25 +131,25 @@ class JoinTestBase protected PointRDD createPointRDD(String location) { final PointRDD rdd = new PointRDD(sc, location, 1, splitter, false, numPartitions); - return new PointRDD(rdd.rawSpatialRDD, StorageLevel.MEMORY_ONLY()); + return new PointRDD(rdd.rawSpatialRDD); } protected LineStringRDD createLineStringRDD(String location) { final LineStringRDD rdd = new LineStringRDD(sc, location, splitter, true, numPartitions); - return new LineStringRDD(rdd.rawSpatialRDD, StorageLevel.MEMORY_ONLY()); + return new LineStringRDD(rdd.rawSpatialRDD); } protected PolygonRDD createPolygonRDD(String location) { final PolygonRDD rdd = new PolygonRDD(sc, location, splitter, true, numPartitions); - return new PolygonRDD(rdd.rawSpatialRDD, StorageLevel.MEMORY_ONLY()); + return new PolygonRDD(rdd.rawSpatialRDD); } protected RectangleRDD createRectangleRDD(String location) { final RectangleRDD rdd = new RectangleRDD(sc, location, splitter, true, numPartitions); - return new RectangleRDD(rdd.rawSpatialRDD, StorageLevel.MEMORY_ONLY()); + return new RectangleRDD(rdd.rawSpatialRDD); } protected void partitionRdds(SpatialRDD<? extends Geometry> queryRDD, diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringKnnTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringKnnTest.java index 155d17d6..72920c57 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringKnnTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringKnnTest.java @@ -127,7 +127,7 @@ public class LineStringKnnTest splitter = FileDataSplitter.getFileDataSplitter(prop.getProperty("splitter")); indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringRangeTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringRangeTest.java index 8f74e6c3..82d1df55 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringRangeTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/LineStringRangeTest.java @@ -129,7 +129,7 @@ public class LineStringRangeTest indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); queryEnvelope = new Envelope(-85.01, -60.01, 34.01, 50.01); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); @@ -164,7 +164,7 @@ public class LineStringRangeTest public void testSpatialRangeQuery() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); assertEquals(resultSize, 999); @@ -181,7 +181,7 @@ public class LineStringRangeTest public void testSpatialRangeQueryUsingIndex() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true); spatialRDD.buildIndex(IndexType.RTREE, false); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).count(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/PointKnnTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/PointKnnTest.java index 1af99ad3..41c3ee51 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/PointKnnTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/PointKnnTest.java @@ -134,7 +134,7 @@ public class PointKnnTest splitter = FileDataSplitter.getFileDataSplitter(prop.getProperty("splitter")); indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/PointRangeTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/PointRangeTest.java index 93aa7de3..8fccc907 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/PointRangeTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/PointRangeTest.java @@ -126,7 +126,7 @@ public class PointRangeTest indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); queryEnvelope = new Envelope(-90.01, -80.01, 30.01, 40.01); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonKnnTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonKnnTest.java index 0d6e7b91..2631b100 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonKnnTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonKnnTest.java @@ -139,7 +139,7 @@ public class PolygonKnnTest splitter = FileDataSplitter.getFileDataSplitter(prop.getProperty("splitter")); indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonRangeTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonRangeTest.java index f526d417..233e8d90 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonRangeTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/PolygonRangeTest.java @@ -127,7 +127,7 @@ public class PolygonRangeTest indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); queryEnvelope = new Envelope(-85.01, -60.01, 34.01, 50.01); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); @@ -162,7 +162,7 @@ public class PolygonRangeTest public void testSpatialRangeQuery() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); assertEquals(resultSize, 704); @@ -179,7 +179,7 @@ public class PolygonRangeTest public void testSpatialRangeQueryUsingIndex() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true); spatialRDD.buildIndex(IndexType.RTREE, false); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).count(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleKnnTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleKnnTest.java index 7f5184e2..e43fe1c3 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleKnnTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleKnnTest.java @@ -135,7 +135,7 @@ public class RectangleKnnTest splitter = FileDataSplitter.getFileDataSplitter(prop.getProperty("splitter")); indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); diff --git a/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleRangeTest.java b/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleRangeTest.java index d5fbe7ac..03e9f4e3 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleRangeTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialOperator/RectangleRangeTest.java @@ -132,7 +132,7 @@ public class RectangleRangeTest indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); queryEnvelope = new Envelope(-90.01, -80.01, 30.01, 40.01); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); @@ -167,7 +167,7 @@ public class RectangleRangeTest public void testSpatialRangeQuery() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); assertEquals(resultSize, 193); @@ -184,7 +184,7 @@ public class RectangleRangeTest public void testSpatialRangeQueryUsingIndex() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true); spatialRDD.buildIndex(IndexType.RTREE, false); for (int i = 0; i < loopTimes; i++) { long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).count(); @@ -201,7 +201,7 @@ public class RectangleRangeTest @Test public void testSpatialRangeQueryLeftCoveredByRightFalse() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true); Coordinate[] coordinates = new Coordinate[5]; coordinates[0] = new Coordinate(queryEnvelope.getMinX(), queryEnvelope.getMinY()); coordinates[1] = new Coordinate(queryEnvelope.getMinX(), queryEnvelope.getMaxY()); diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/GeometryOpTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/GeometryOpTest.java index 75d82cb4..17144247 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/GeometryOpTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/GeometryOpTest.java @@ -50,7 +50,7 @@ public class GeometryOpTest extends SpatialRDDTestBase @Test public void testFlipPolygonCoordinates() { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); Polygon oldGeom = spatialRDD.rawSpatialRDD.take(1).get(0); spatialRDD.flipCoordinates(); Polygon newGeom = spatialRDD.rawSpatialRDD.take(1).get(0); diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java index fe7692ed..1020961b 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java @@ -66,7 +66,7 @@ public class LineStringRDDTest public void testConstructor() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); assertEquals(inputCount, spatialRDD.approximateTotalCount); assertEquals(inputBoundary, spatialRDD.boundaryEnvelope); } @@ -75,7 +75,7 @@ public class LineStringRDDTest public void testEmptyConstructor() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); // Create an empty spatialRDD and manually assemble it @@ -94,7 +94,7 @@ public class LineStringRDDTest public void testBuildIndexWithoutSetGrid() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.buildIndex(IndexType.RTREE, false); } @@ -107,7 +107,7 @@ public class LineStringRDDTest public void testBuildRtreeIndex() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -127,7 +127,7 @@ public class LineStringRDDTest public void testBuildQuadtreeIndex() throws Exception { - LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD spatialRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.QUADTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -156,7 +156,7 @@ public class LineStringRDDTest public void testMBR() throws Exception { - LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation, splitter, true, numPartitions); RectangleRDD rectangleRDD = lineStringRDD.MinimumBoundingRectangle(); List<Polygon> result = rectangleRDD.rawSpatialRDD.collect(); assert result.size() > -1; diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/PointRDDTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/PointRDDTest.java index bca05638..c00fdd11 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/PointRDDTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/PointRDDTest.java @@ -64,7 +64,7 @@ public class PointRDDTest @Test public void testConstructor() { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); assertEquals(inputCount, spatialRDD.approximateTotalCount); assertEquals(inputBoundary, spatialRDD.boundaryEnvelope); assert spatialRDD.rawSpatialRDD.take(9).get(0).getUserData().equals("testattribute0\ttestattribute1\ttestattribute2"); @@ -77,7 +77,7 @@ public class PointRDDTest public void testEmptyConstructor() throws Exception { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.buildIndex(IndexType.RTREE, false); // Create an empty spatialRDD and manually assemble it PointRDD spatialRDDcopy = new PointRDD(); @@ -95,7 +95,7 @@ public class PointRDDTest public void testBuildIndexWithoutSetGrid() throws Exception { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.buildIndex(IndexType.RTREE, false); } @@ -108,7 +108,7 @@ public class PointRDDTest public void testBuildRtreeIndex() throws Exception { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -128,7 +128,7 @@ public class PointRDDTest public void testBuildQuadtreeIndex() throws Exception { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.QUADTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java index 49b0d397..5edbd789 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java @@ -75,7 +75,7 @@ public class PolygonRDDTest @Test public void testConstructor() { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); assertEquals(inputCount, spatialRDD.approximateTotalCount); assertEquals(inputBoundary, spatialRDD.boundaryEnvelope); } @@ -84,7 +84,7 @@ public class PolygonRDDTest public void testEmptyConstructor() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); // Create an empty spatialRDD and manually assemble it @@ -97,7 +97,7 @@ public class PolygonRDDTest @Test public void testGeoJSONConstructor() { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationGeojson, FileDataSplitter.GEOJSON, true, 4, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationGeojson, FileDataSplitter.GEOJSON, true, 4); assert spatialRDD.approximateTotalCount == 1001; assert spatialRDD.boundaryEnvelope != null; assertEquals(spatialRDD.rawSpatialRDD.take(1).get(0).getUserData(), "01\t077\t011501\t5\t1500000US010770115015\t010770115015\t5\tBG\t6844991\t32636"); @@ -108,7 +108,7 @@ public class PolygonRDDTest @Test public void testWktConstructor() { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationWkt, FileDataSplitter.WKT, true, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationWkt, FileDataSplitter.WKT, true); assert spatialRDD.approximateTotalCount == 103; assert spatialRDD.boundaryEnvelope != null; assert spatialRDD.rawSpatialRDD.take(1).get(0).getUserData().equals("31\t039\t00835841\t31039\tCuming\tCuming County\t06\tH1\tG4020\t\t\t\tA\t1477895811\t10447360\t+41.9158651\t-096.7885168"); @@ -117,7 +117,7 @@ public class PolygonRDDTest @Test public void testWkbConstructor() { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationWkb, FileDataSplitter.WKB, true, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocationWkb, FileDataSplitter.WKB, true); assert spatialRDD.approximateTotalCount == 103; assert spatialRDD.boundaryEnvelope != null; assert spatialRDD.rawSpatialRDD.take(1).get(0).getUserData().equals("31\t039\t00835841\t31039\tCuming\tCuming County\t06\tH1\tG4020\t\t\t\tA\t1477895811\t10447360\t+41.9158651\t-096.7885168"); @@ -132,7 +132,7 @@ public class PolygonRDDTest public void testBuildIndexWithoutSetGrid() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.buildIndex(IndexType.RTREE, false); } @@ -145,7 +145,7 @@ public class PolygonRDDTest public void testBuildRtreeIndex() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -165,7 +165,7 @@ public class PolygonRDDTest public void testBuildQuadtreeIndex() throws Exception { - PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD spatialRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.QUADTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -185,7 +185,7 @@ public class PolygonRDDTest public void testMBR() throws Exception { - PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, splitter, true, numPartitions); RectangleRDD rectangleRDD = polygonRDD.MinimumBoundingRectangle(); List<Polygon> result = rectangleRDD.rawSpatialRDD.collect(); assert result.size() > -1; diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/RectangleRDDTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/RectangleRDDTest.java index aa63f217..25410045 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/RectangleRDDTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/RectangleRDDTest.java @@ -66,7 +66,7 @@ public class RectangleRDDTest public void testConstructor() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions); assertEquals(inputCount, spatialRDD.approximateTotalCount); assertEquals(inputBoundary, spatialRDD.boundaryEnvelope); } @@ -75,7 +75,7 @@ public class RectangleRDDTest public void testEmptyConstructor() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.buildIndex(IndexType.RTREE, false); // Create an empty spatialRDD and manually assemble it RectangleRDD spatialRDDcopy = new RectangleRDD(); @@ -106,7 +106,7 @@ public class RectangleRDDTest public void testBuildRtreeIndex() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.RTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { @@ -126,7 +126,7 @@ public class RectangleRDDTest public void testBuildQuadtreeIndex() throws Exception { - RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + RectangleRDD spatialRDD = new RectangleRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.spatialPartitioning(gridType); spatialRDD.buildIndex(IndexType.QUADTREE, true); if (spatialRDD.indexedRDD.take(1).get(0) instanceof STRtree) { diff --git a/core/src/test/java/org/apache/sedona/core/spatialRDD/SpatialRDDWriterTest.java b/core/src/test/java/org/apache/sedona/core/spatialRDD/SpatialRDDWriterTest.java index 123f9e9f..680f80a9 100644 --- a/core/src/test/java/org/apache/sedona/core/spatialRDD/SpatialRDDWriterTest.java +++ b/core/src/test/java/org/apache/sedona/core/spatialRDD/SpatialRDDWriterTest.java @@ -82,11 +82,11 @@ public class SpatialRDDWriterTest File wkb = new File(testSaveAsWKBWithData); if (wkb.exists()) { FileUtils.deleteDirectory(wkb);} - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.saveAsWKB(testSaveAsWKBWithData); // Load the saved rdd and compare them - PointRDD resultWKB = new PointRDD(sc, testSaveAsWKBWithData, 0, FileDataSplitter.WKB, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD resultWKB = new PointRDD(sc, testSaveAsWKBWithData, 0, FileDataSplitter.WKB, true, numPartitions); assertEquals(resultWKB.rawSpatialRDD.count(), spatialRDD.rawSpatialRDD.count()); verifyResult(resultWKB.rawSpatialRDD.takeOrdered(5), spatialRDD.rawSpatialRDD.takeOrdered(5)); @@ -102,11 +102,11 @@ public class SpatialRDDWriterTest File wkt = new File(testSaveAsWKTWithData); if (wkt.exists()) {FileUtils.deleteDirectory(wkt);} - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions); spatialRDD.saveAsWKT(testSaveAsWKTWithData); // Load the saved rdd and compare them - PointRDD resultWKT = new PointRDD(sc, testSaveAsWKTWithData, 0, FileDataSplitter.WKT, true, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD resultWKT = new PointRDD(sc, testSaveAsWKTWithData, 0, FileDataSplitter.WKT, true, numPartitions); assertEquals(resultWKT.rawSpatialRDD.count(), spatialRDD.rawSpatialRDD.count()); verifyResult(resultWKT.rawSpatialRDD.takeOrdered(5), spatialRDD.rawSpatialRDD.takeOrdered(5)); @@ -122,11 +122,11 @@ public class SpatialRDDWriterTest File wkb = new File(testSaveAsWKB); if (wkb.exists()) { FileUtils.deleteDirectory(wkb);} - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, false, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, false, numPartitions); spatialRDD.saveAsWKB(testSaveAsWKB); // Load the saved rdd and compare them - PointRDD resultWKB = new PointRDD(sc, testSaveAsWKB, 0, FileDataSplitter.WKB, false, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD resultWKB = new PointRDD(sc, testSaveAsWKB, 0, FileDataSplitter.WKB, false, numPartitions); assertEquals(resultWKB.rawSpatialRDD.count(), spatialRDD.rawSpatialRDD.count()); verifyResult(resultWKB.rawSpatialRDD.takeOrdered(5), spatialRDD.rawSpatialRDD.takeOrdered(5)); @@ -142,11 +142,11 @@ public class SpatialRDDWriterTest File wkt = new File(testSaveAsWKT); if (wkt.exists()) {FileUtils.deleteDirectory(wkt);} - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, false, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, false, numPartitions); spatialRDD.saveAsWKT(testSaveAsWKT); // Load the saved rdd and compare them - PointRDD resultWKT = new PointRDD(sc, testSaveAsWKT, 0, FileDataSplitter.WKT, false, numPartitions, StorageLevel.MEMORY_ONLY()); + PointRDD resultWKT = new PointRDD(sc, testSaveAsWKT, 0, FileDataSplitter.WKT, false, numPartitions); assertEquals(resultWKT.rawSpatialRDD.count(), spatialRDD.rawSpatialRDD.count()); verifyResult(resultWKT.rawSpatialRDD.takeOrdered(5), spatialRDD.rawSpatialRDD.takeOrdered(5)); diff --git a/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java b/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java index 398c73aa..e051d833 100644 --- a/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java +++ b/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java @@ -161,7 +161,7 @@ public class CRSTransformationTest indexType = IndexType.getIndexType(prop.getProperty("indexType")); numPartitions = Integer.parseInt(prop.getProperty("numPartitions")); queryEnvelope = new Envelope(30.01, 40.01, -90.01, -80.01); - loopTimes = 5; + loopTimes = 1; } catch (IOException ex) { ex.printStackTrace(); @@ -202,148 +202,10 @@ public class CRSTransformationTest public void testSpatialRangeQuery() throws Exception { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - for (int i = 0; i < loopTimes; i++) { - long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); - assert resultSize == 3127; - } + PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true); + spatialRDD.CRSTransform( "epsg:4326", "epsg:3005"); + long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).count(); + assert resultSize == 3127; assert RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, false).take(10).get(1).getUserData().toString() != null; } - - /** - * Test spatial range query using index. - * - * @throws Exception the exception - */ - @Test - public void testSpatialRangeQueryUsingIndex() - throws Exception - { - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - spatialRDD.buildIndex(IndexType.RTREE, false); - for (int i = 0; i < loopTimes; i++) { - long resultSize = RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).count(); - assert resultSize == 3127; - } - assert RangeQuery.SpatialRangeQuery(spatialRDD, queryEnvelope, false, true).take(10).get(1).getUserData().toString() != null; - } - - /** - * Test spatial knn query. - * - * @throws Exception the exception - */ - @Test - public void testSpatialKnnQuery() - throws Exception - { - PointRDD pointRDD = new PointRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - - for (int i = 0; i < loopTimes; i++) { - List<Point> result = KNNQuery.SpatialKnnQuery(pointRDD, queryPoint, topK, false); - assert result.size() > 0; - assert result.get(0).getUserData().toString() != null; - //System.out.println(result.get(0).getUserData().toString()); - } - } - - /** - * Test spatial knn query using index. - * - * @throws Exception the exception - */ - @Test - public void testSpatialKnnQueryUsingIndex() - throws Exception - { - PointRDD pointRDD = new PointRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - pointRDD.buildIndex(IndexType.RTREE, false); - for (int i = 0; i < loopTimes; i++) { - List<Point> result = KNNQuery.SpatialKnnQuery(pointRDD, queryPoint, topK, true); - assert result.size() > 0; - assert result.get(0).getUserData().toString() != null; - //System.out.println(result.get(0).getUserData().toString()); - } - } - - /** - * Test spatial KNN correctness. - * - * @throws Exception the exception - */ - @Test - public void testSpatialKNNCorrectness() - throws Exception - { - PointRDD pointRDD = new PointRDD(sc, InputLocation, offset, splitter, true, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - List<Point> resultNoIndex = KNNQuery.SpatialKnnQuery(pointRDD, queryPoint, topK, false); - pointRDD.buildIndex(IndexType.RTREE, false); - List<Point> resultWithIndex = KNNQuery.SpatialKnnQuery(pointRDD, queryPoint, topK, true); - GeometryDistanceComparator geometryDistanceComparator = new GeometryDistanceComparator(queryPoint, true); - List<Point> resultNoIndexModifiable = new ArrayList<>(resultNoIndex); - List<Point> resultWithIndexModifiable = new ArrayList<>(resultWithIndex); - Collections.sort(resultNoIndexModifiable, geometryDistanceComparator); - Collections.sort(resultWithIndexModifiable, geometryDistanceComparator); - int difference = 0; - for (int i = 0; i < topK; i++) { - if (geometryDistanceComparator.compare(resultNoIndex.get(i), resultWithIndex.get(i)) != 0) { - difference++; - } - } - assert difference == 0; - } - - /** - * Test spatial join query with polygon RDD. - * - * @throws Exception the exception - */ - @Test - public void testSpatialJoinQueryWithPolygonRDD() - throws Exception - { - - PolygonRDD queryRDD = new PolygonRDD(sc, InputLocationQueryPolygon, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - - spatialRDD.spatialPartitioning(gridType); - - queryRDD.spatialPartitioning(spatialRDD.getPartitioner()); - - List<Tuple2<Polygon, List<Point>>> result = JoinQuery.SpatialJoinQuery(spatialRDD, queryRDD, false, true).collect(); - - assert result.get(1)._1().getUserData() != null; - for (int i = 0; i < result.size(); i++) { - assert result.get(i)._2().size() == 0 || result.get(i)._2().iterator().next().getUserData() != null; - } - } - - /** - * Test spatial join query with polygon RDD using R tree index. - * - * @throws Exception the exception - */ - @Test - public void testSpatialJoinQueryWithPolygonRDDUsingRTreeIndex() - throws Exception - { - - PolygonRDD queryRDD = new PolygonRDD(sc, InputLocationQueryPolygon, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - - PointRDD spatialRDD = new PointRDD(sc, InputLocation, offset, splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", "epsg:3005"); - - spatialRDD.spatialPartitioning(gridType); - - spatialRDD.buildIndex(IndexType.RTREE, true); - - queryRDD.spatialPartitioning(spatialRDD.getPartitioner()); - - List<Tuple2<Polygon, List<Point>>> result = JoinQuery.SpatialJoinQuery(spatialRDD, queryRDD, false, true).collect(); - - assert result.get(1)._1().getUserData() != null; - for (int i = 0; i < result.size(); i++) { - assert result.get(i)._2().size() == 0 || result.get(i)._2().iterator().next().getUserData() != null; - } - } } diff --git a/core/src/test/scala/org/apache/sedona/core/scalaTest.scala b/core/src/test/scala/org/apache/sedona/core/scalaTest.scala index 78492bb2..6cc59c7b 100644 --- a/core/src/test/scala/org/apache/sedona/core/scalaTest.scala +++ b/core/src/test/scala/org/apache/sedona/core/scalaTest.scala @@ -23,10 +23,8 @@ import org.apache.sedona.common.enums.FileDataSplitter import org.apache.sedona.core.enums.{GridType, IndexType, JoinBuildSide} import org.apache.sedona.core.formatMapper.EarthdataHDFPointMapper import org.apache.sedona.core.spatialOperator.JoinQuery.JoinParams -import org.apache.sedona.core.spatialOperator.SpatialPredicate -import org.apache.sedona.core.spatialOperator.{JoinQuery, KNNQuery, RangeQuery} +import org.apache.sedona.core.spatialOperator.{JoinQuery, KNNQuery, RangeQuery, SpatialPredicate} import org.apache.sedona.core.spatialRDD.{CircleRDD, PointRDD, PolygonRDD} -import org.apache.spark.storage.StorageLevel import org.locationtech.jts.geom.{Coordinate, Envelope, GeometryFactory} class scalaTest extends SparkUtil { @@ -235,19 +233,4 @@ class scalaTest extends SparkUtil { i = i + 1 } } - - test("should pass CRS transformed spatial range query") { - val objectRDD = new PointRDD(sc, PointRDDInputLocation, PointRDDOffset, PointRDDSplitter, false, StorageLevel.NONE, "epsg:4326", "epsg:3005") - for (i <- 1 to eachQueryLoopTimes) { - val resultSize = RangeQuery.SpatialRangeQuery(objectRDD, rangeQueryWindow, false, false).count - } - } - - test("should pass CRS transformed spatial range query using index") { - val objectRDD = new PointRDD(sc, PointRDDInputLocation, PointRDDOffset, PointRDDSplitter, false, StorageLevel.NONE, "epsg:4326", "epsg:3005") - objectRDD.buildIndex(PointRDDIndexType, false) - for (i <- 1 to eachQueryLoopTimes) { - val resultSize = RangeQuery.SpatialRangeQuery(objectRDD, rangeQueryWindow, false, true).count - } - } }
