示例#1
0
  public Iterator<PartitionLocator> locatorScan(
      final AbstractScaleOutFederation<?> fed, final IPredicate<?> predicate) {

    final long timestamp = getReadTimestamp();

    // Note: assumes that we are NOT using a view of two relations.
    final IRelation<?> relation =
        (IRelation<?>) fed.getResourceLocator().locate(predicate.getOnlyRelationName(), timestamp);

    /*
     * Find the best access path for the predicate for that relation.
     *
     * Note: All we really want is the [fromKey] and [toKey] for that
     * predicate and index. This MUST NOT layer on expanders since the
     * layering also hides the [fromKey] and [toKey].
     */
    @SuppressWarnings("unchecked")
    final AccessPath<?> accessPath = (AccessPath<?>) relation.getAccessPath((IPredicate) predicate);

    // Note: assumes scale-out (EDS or JDS).
    final IClientIndex ndx = (IClientIndex) accessPath.getIndex();

    /*
     * Note: could also be formed from relationName + "." +
     * keyOrder.getIndexName(), which is cheaper unless the index metadata
     * is cached.
     */
    final String name = ndx.getIndexMetadata().getName();

    return fed.locatorScan(
        name, timestamp, accessPath.getFromKey(), accessPath.getToKey(), false /* reverse */);
  }
示例#2
0
  public IAccessPath getTailAccessPath(final IRelation relation, final IPredicate predicate) {

    return relation.getAccessPath(
        indexManager /* localIndexManager */, relation.getKeyOrder(predicate), predicate);

    //        if (predicate.getPartitionId() != -1) {
    //
    //            /*
    //             * Note: This handles a read against a local index partition. For
    //             * scale-out, the [indexManager] will be the data service's local
    //             * index manager.
    //             *
    //             * Note: Expanders ARE NOT applied in this code path. Expanders
    //             * require a total view of the relation, which is not available
    //             * during scale-out pipeline joins. Likewise, the [backchain]
    //             * property will be ignored since it is handled by an expander.
    //             */
    //
    //            return ((AbstractRelation<?>) relation)
    //                    .getAccessPathForIndexPartition(indexManager, predicate);
    //
    //        }
    //
    //        // Find the best access path for the predicate for that relation.
    //        final IAccessPath<?> accessPath = relation.getAccessPath(predicate);
    //
    //        // Note: No expander's for bops, at least not right now.
    ////        final ISolutionExpander expander = predicate.getSolutionExpander();
    ////
    ////        if (expander != null) {
    ////
    ////            // allow the predicate to wrap the access path
    ////            accessPath = expander.getAccessPath(accessPath);
    ////
    ////        }
    //
    //        // return that access path.
    //        return accessPath;
  }