def test_constructor(self): spatial_rdd = RectangleRDD( sparkContext=self.sc, InputLocation=inputLocation, Offset=offset, splitter=splitter, carryInputData=True, partitions=numPartitions, newLevel=StorageLevel.MEMORY_ONLY ) spatial_rdd.analyze() assert inputCount == spatial_rdd.approximateTotalCount assert inputBoundary == spatial_rdd.boundaryEnvelope spatial_rdd = RectangleRDD( self.sc, inputLocation, offset, splitter, True, numPartitions, StorageLevel.MEMORY_ONLY ) spatial_rdd.analyze() assert inputCount == spatial_rdd.approximateTotalCount assert inputBoundary == spatial_rdd.boundaryEnvelope
def test_build_index_without_set_grid(self): spatial_rdd = RectangleRDD(sparkContext=self.sc, InputLocation=inputLocation, Offset=offset, splitter=splitter, carryInputData=True, partitions=numPartitions) spatial_rdd.analyze() spatial_rdd.buildIndex(IndexType.RTREE, False)
def test_empty_constructor(self): spatial_rdd = RectangleRDD(sparkContext=self.sc, InputLocation=inputLocation, Offset=offset, splitter=splitter, carryInputData=True, partitions=numPartitions, newLevel=StorageLevel.MEMORY_ONLY) spatial_rdd.analyze() spatial_rdd.buildIndex(IndexType.RTREE, False) spatial_rdd_copy = RectangleRDD() spatial_rdd_copy.rawJvmSpatialRDD = spatial_rdd.rawJvmSpatialRDD spatial_rdd_copy.analyze()
def test_voronoi_spatial_partitioning(self): spatial_rdd = RectangleRDD( sparkContext=self.sc, InputLocation=inputLocation, Offset=offset, splitter=splitter, carryInputData=True, partitions=10, newLevel=StorageLevel.MEMORY_ONLY ) spatial_rdd.analyze() spatial_rdd.spatialPartitioning(GridType.VORONOI) for envelope in spatial_rdd.grids: print(envelope) assert spatial_rdd.countWithoutDuplicates() == spatial_rdd.countWithoutDuplicatesSPRDD()