def METHOD_NAME(self, num_partitions, grid_type, index_type):
    query_rdd = self.create_rectangle_rdd(input_location, splitter, num_partitions)
    spatial_rdd = self.create_rectangle_rdd(input_location, splitter, num_partitions)
    self.partition_rdds(query_rdd, spatial_rdd, grid_type)
    spatial_rdd.buildIndex(index_type, True)
    result = JoinQuery.SpatialJoinQuery(
        spatial_rdd, query_rdd, False, True).collect()
    self.sanity_check_join_results(result)
    expected_count = match_with_original_duplicates_count if self.expect_to_preserve_original_duplicates(
        grid_type) else match_count
    assert expected_count == self.count_join_results(result)