T
-public class QuadTreeDistIndex<T> extends DistributedSpatialIndex<T>
DistributedSpatialIndex
based on a QuadTreeConstructor and Description |
---|
QuadTreeDistIndex(java.lang.Class<T> type)
Crates a new instance ready for an RDD of the given generic type
|
Modifier and Type | Method and Description |
---|---|
void |
cache()
Persist the index' internal RDD with the default storage level
|
SpatialJavaRDD<T> |
filter(<any> filterFunc, SpatialOperationConfig spatialOpConf)
Returns a new spatial RDD containing only the elements that satisfy both, the filtering function and the spatial operation
|
<R> <any> |
flatMap(<any> f, SpatialOperationConfig spatialOpConf)
Returns a new RDD by first spatially filtering the RDD elements using the spatial operation given by spatialOpConf, then a function is applied to all the remaining elements.
|
double[] |
getMBR()
Returns the minimum bounding rectangle, that is, the rectangle enclosing all the data from the current index
|
boolean |
isLocallyIndexed()
Returns true if the current index's partitions contain a local spatial index
|
<T2,R> <any> |
join(SpatialJavaRDD<T2> rdd2, <any> f, SpatialOperationConfig spatialOpConf) |
java.util.List<<any>> |
nearestNeighbors(<any> f, int k, SpatialOperationConfig spatialOpConf)
Returns the k elements from the RDD which are closest to the query window defined in spatialOpConf
|
void |
persist(StorageLevel storageLevel)
Sets the index' internal RDD's storage level to persist its values across operations after the first time it is computed.
|
SpatialJavaRDD<T> |
primaryFilter(<any> filterFunc, SpatialOperationConfig spatialOpConf)
Returns a new spatial RDD containing the elements which satisfy the filtering lambda function an which are likely to interact with the query window defined in the passes spatial operation configuration.
|
void |
read(JavaSparkContext sc, java.lang.String file)
Loads a persisted index from the given path.
|
<T2,R> <any> |
spatialJoin(DistributedSpatialIndex<T2> index2, <any> f, SpatialOperationConfig spatialOpConf)
Joins records from the current index with records of the passed spatial index.
|
<T2,R> <any> |
spatialJoin(SpatialJavaRDD<T2> rdd2, <any> f, SpatialOperationConfig spatialOpConf)
Joins records from the current index with records of the passed spatial RDD.
|
void |
unpersist()
Marks the index' internal RDD as non-persistent
|
void |
write(JavaSparkContext sc, java.lang.String pathStr)
Writes the current index to the given path
|
createIndex, load, load, save
public QuadTreeDistIndex(java.lang.Class<T> type)
type
-public void cache()
DistributedSpatialIndex
cache
in class DistributedSpatialIndex<T>
public SpatialJavaRDD<T> filter(<any> filterFunc, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
filter
in class DistributedSpatialIndex<T>
filterFunc
- a filtering functionspatialOpConf
- the spatial operation configuration to spatially filter the RDDSpatialJavaRDD
java.lang.Exception
public <R> <any> flatMap(<any> f, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
flatMap
in class DistributedSpatialIndex<T>
f
- a function to apply to each elementspatialOpConf
- the spatial operation configuration to spatially filter the RDDjava.lang.Exception
public double[] getMBR()
DistributedSpatialIndex
getMBR
in class DistributedSpatialIndex<T>
public boolean isLocallyIndexed()
DistributedSpatialIndex
isLocallyIndexed
in class DistributedSpatialIndex<T>
public <T2,R> <any> join(SpatialJavaRDD<T2> rdd2, <any> f, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
join
in class DistributedSpatialIndex<T>
rdd2
- a spatial RDD to joinf
- a lambda function called for each pair of joined records.spatialOpConf
- defines the spatial interaction used to join two recordsjava.lang.Exception
public java.util.List<<any>> nearestNeighbors(<any> f, int k, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
nearestNeighbors
in class DistributedSpatialIndex<T>
f
- an optional filtering function which should return true for the elements which can be part of the solutionk
- the number of nearest neighbors to returnspatialOpConf
- a spatial configuration containing the query window to be used. SpatialOperation is ignored for this action.java.lang.Exception
public void persist(StorageLevel storageLevel)
DistributedSpatialIndex
persist
in class DistributedSpatialIndex<T>
public SpatialJavaRDD<T> primaryFilter(<any> filterFunc, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
primaryFilter
in class DistributedSpatialIndex<T>
filterFunc
- a filtering functionspatialOpConf
- the spatial operation configuration to spatially filter the RDDSpatialJavaRDD
java.lang.Exception
public void read(JavaSparkContext sc, java.lang.String file) throws java.lang.Exception
DistributedSpatialIndex
read
in class DistributedSpatialIndex<T>
sc
- an existing Spark contextfile
- a path on either, a local or distributed file systemjava.lang.Exception
public <T2,R> <any> spatialJoin(DistributedSpatialIndex<T2> index2, <any> f, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
SpatialOperationConfig
. The type of the resulting records is defined by the user-provided lambda function.spatialJoin
in class DistributedSpatialIndex<T>
index2
- a spatial index to joinf
- a lambda function called for each pair of joined records.spatialOpConf
- defines the spatial interaction used to join two recordsjava.lang.Exception
public <T2,R> <any> spatialJoin(SpatialJavaRDD<T2> rdd2, <any> f, SpatialOperationConfig spatialOpConf) throws java.lang.Exception
DistributedSpatialIndex
SpatialOperationConfig
. The type of the resulting records is defined by the user-provided lambda function.spatialJoin
in class DistributedSpatialIndex<T>
rdd2
- a spatial RDD to joinf
- a lambda function called for each pair of joined records.spatialOpConf
- defines the spatial interaction used to join two recordsjava.lang.Exception
public void unpersist()
DistributedSpatialIndex
unpersist
in class DistributedSpatialIndex<T>
public void write(JavaSparkContext sc, java.lang.String pathStr) throws java.lang.Exception
DistributedSpatialIndex
write
in class DistributedSpatialIndex<T>
sc
- an existing Spark contextpathStr
- a path on either, a local or distributed file systemjava.lang.Exception
Copyright © 2017 Oracle and/or its affiliates. All Rights Reserved.