コード例 #1
0
    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
コード例 #2
0
    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)
コード例 #3
0
    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()
コード例 #4
0
    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()