Search in sources :

Example 1 with SpatialJoin

use of com.geophile.z.SpatialJoin in project fdb-record-layer by FoundationDB.

the class GeophileSpatialIndexJoinPlan method execute.

@Nonnull
public <M extends Message> RecordCursor<Pair<FDBIndexedRecord<M>, FDBIndexedRecord<M>>> execute(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context) {
    final SpatialJoin spatialJoin = SpatialJoin.newSpatialJoin(SpatialJoin.Duplicates.INCLUDE);
    final GeophileSpatialJoin geophileSpatialJoin = new GeophileSpatialJoin(spatialJoin, store.getUntypedRecordStore(), context);
    final SpatialIndex<GeophileRecordImpl> leftSpatialIndex = geophileSpatialJoin.getSpatialIndex(leftIndexName, leftPrefixComparisons);
    final SpatialIndex<GeophileRecordImpl> rightSpatialIndex = geophileSpatialJoin.getSpatialIndex(rightIndexName, rightPrefixComparisons);
    return fetchIndexRecords(store, geophileSpatialJoin.recordCursor(leftSpatialIndex, rightSpatialIndex));
}
Also used : SpatialJoin(com.geophile.z.SpatialJoin) Nonnull(javax.annotation.Nonnull)

Example 2 with SpatialJoin

use of com.geophile.z.SpatialJoin in project fdb-record-layer by FoundationDB.

the class GeophileSpatialObjectQueryPlan method executeEntries.

@Nonnull
@Override
public <M extends Message> RecordCursor<IndexEntry> executeEntries(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable byte[] continuation, @Nonnull ExecuteProperties executeProperties) {
    if (continuation != null) {
        throw new RecordCoreException("continuations are not yet supported");
    }
    final SpatialObject spatialObject = getSpatialObject(context);
    if (spatialObject == null) {
        return RecordCursor.empty();
    }
    final SpatialJoin spatialJoin = SpatialJoin.newSpatialJoin(SpatialJoin.Duplicates.INCLUDE, getFilter(context));
    final GeophileSpatialJoin geophileSpatialJoin = new GeophileSpatialJoin(spatialJoin, store.getUntypedRecordStore(), context);
    final SpatialIndex<GeophileRecordImpl> spatialIndex = geophileSpatialJoin.getSpatialIndex(indexName, prefixComparisons, getRecordFunction());
    return geophileSpatialJoin.recordCursor(spatialObject, spatialIndex);
}
Also used : RecordCoreException(com.apple.foundationdb.record.RecordCoreException) SpatialJoin(com.geophile.z.SpatialJoin) SpatialObject(com.geophile.z.SpatialObject) RecordWithSpatialObject(com.geophile.z.index.RecordWithSpatialObject) Nonnull(javax.annotation.Nonnull)

Aggregations

SpatialJoin (com.geophile.z.SpatialJoin)2 Nonnull (javax.annotation.Nonnull)2 RecordCoreException (com.apple.foundationdb.record.RecordCoreException)1 SpatialObject (com.geophile.z.SpatialObject)1 RecordWithSpatialObject (com.geophile.z.index.RecordWithSpatialObject)1