E
- The generic type of the [E]lements of the relation.public abstract class AbstractRelation<E> extends AbstractResource<IRelation<E>> implements IMutableRelation<E>
IRelation
and IMutableRelation
impls.AbstractResource.Options
indexManager, log
Modifier | Constructor and Description |
---|---|
protected |
AbstractRelation(IIndexManager indexManager,
String namespace,
Long timestamp,
Properties properties) |
protected |
AbstractRelation(ILocatableResource container,
IIndexManager indexManager,
String namespace,
Long timestamp,
Properties properties)
Alternative version used when a resource exists within some container.
|
Modifier and Type | Method and Description |
---|---|
IAccessPath<E> |
getAccessPath(IIndexManager localIndexManager,
IKeyOrder<E> keyOrder,
IPredicate<E> predicate)
Return the
IAccessPath for an IRelation using the
specified IIndexManager and IKeyOrder (core impl). |
IAccessPath<E> |
getAccessPath(IKeyOrder<E> keyOrder,
IPredicate<E> predicate)
|
IAccessPath<E> |
getAccessPath(IPredicate<E> predicate)
Return the best
IAccessPath for a relation given a predicate with
zero or more unbound variables. |
String |
getFQN(IKeyOrder<? extends E> keyOrder)
The fully qualified name of the index.
|
static <E> String |
getFQN(IRelation<E> relation,
IKeyOrder<? extends E> keyOrder)
The fully qualified name of the index.
|
static <E> String |
getFQN(IRelation<E> relation,
String localName)
The fully qualified name of the index.
|
static IIndex |
getIndex(IIndexManager indexManager,
String fqn,
long timestamp)
Return the named index using the timestamp for this view of the relation.
|
IIndex |
getIndex(IKeyOrder<? extends E> keyOrder)
Return the index for the
IKeyOrder the timestamp for this view of
the relation. |
IIndex |
getIndex(String fqn)
Return the named index using the timestamp for this view of the relation.
|
IAccessPath<E> |
newAccessPath(IIndexManager localIndexManager,
IPredicate<E> predicate,
IKeyOrder<E> keyOrder)
IAccessPath factory. |
protected IndexMetadata |
newIndexMetadata(String name)
Default factory for
IndexMetadata . |
acquireExclusiveLock, assertWritable, create, destroy, getBareProperties, getChunkCapacity, getChunkOfChunksCapacity, getChunkTimeout, getCommitTime, getContainer, getContainerNamespace, getExecutorService, getFullyBufferedReadThreshold, getIndexManager, getMaxParallelSubqueries, getNamespace, getProperties, getProperty, getProperty, getTimestamp, init, isForceSerialExecution, isReadOnly, toString, unlock
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
delete, insert
getElementClass, getExecutorService, getIndexManager, getIndexNames, getKeyOrder, getKeyOrders, getPrimaryKeyOrder, newElement
create, destroy
getContainerNamespace, getNamespace, getTimestamp, init
protected AbstractRelation(IIndexManager indexManager, String namespace, Long timestamp, Properties properties)
protected AbstractRelation(ILocatableResource container, IIndexManager indexManager, String namespace, Long timestamp, Properties properties)
public static <E> String getFQN(IRelation<E> relation, IKeyOrder<? extends E> keyOrder)
relation
- The relation.keyOrder
- The natural index order.public static <E> String getFQN(IRelation<E> relation, String localName)
relation
- The relation.localName
- The local name of the index.public IIndex getIndex(IKeyOrder<? extends E> keyOrder)
IKeyOrder
the timestamp for this view of
the relation.getIndex
in interface IRelation<E>
keyOrder
- The natural index order.null
iff the index does not exist as
of the timestamp for this view of the relation.getIndex(String)
public IIndex getIndex(String fqn)
fqn
- The fully qualified name of the index.null
iff the named index does
not exist as of that timestamp.IllegalArgumentException
- if name is null
.BOpContextBase#getIndex(IIndexManager, String, long)
public static IIndex getIndex(IIndexManager indexManager, String fqn, long timestamp)
While both the IBigdataFederation
imposes the
ConcurrencyManager
on all access to a named index, neither the
Journal
nor the TemporaryRawStore
does this. Therefore
this method encapsulates the unisolated index for the latter classes in
order to impose the correct concurrency constraints. It does this using
an UnisolatedReadWriteIndex
. This allows the caller to use the
returned index view without regard to concurrency controls (it will
appear to be a thread-safe object).
indexManager
- indexManagerfqn
- The fully qualified name of the index.timestamp
- The timestamp of the view.null
iff the named index does
not exist as of that timestamp.IllegalArgumentException
- if indexManager is null
.IllegalArgumentException
- if name is null
.protected IndexMetadata newIndexMetadata(String name)
IndexMetadata
.name
- The fully qualified index name.IndexMetadata
object for that index.public IAccessPath<E> newAccessPath(IIndexManager localIndexManager, IPredicate<E> predicate, IKeyOrder<E> keyOrder)
IAccessPath
factory.localIndexManager
- The local index manager (optional, except when there is a
request for a shard local access path in scale-out).predicate
- The predicate used to request the access path.keyOrder
- The index which the access path will use.public final IAccessPath<E> getAccessPath(IPredicate<E> predicate)
IRelation
IAccessPath
for a relation given a predicate with
zero or more unbound variables.
If there is an IIndex
that directly corresponds to the natural
order implied by the variable pattern on the predicate then the access
path should use that index. Otherwise you should choose the best index
given the constraints and make sure that the IAccessPath
incorporates additional filters that will allow you to filter out the
irrelevant ITuple
s during the scan - this is very important when
the index is remote!
If there are any IElementFilter
s then the access path MUST
incorporate those constraints such that only elements that satisfy the
constraints may be visited.
Whether the constraints arise because of the lack of a perfect index for
the access path or because they were explicitly specified for the
IPredicate
, those constraints should be translated into
constraints imposed on the underlying ITupleIterator
and sent
with it to be evaluated local to the data.
Note: Filters should be specified when the IAccessPath
is
constructed so that they will be evaluated on the data service rather
than materializing the elements and then filtering then. This can be
accomplished by adding the filter as a constraint on the predicate when
specifying the access path.
getAccessPath
in interface IRelation<E>
predicate
- The constraint on the elements to be visited.IAccessPath
for that IPredicate
.IRelation.getAccessPath(IKeyOrder, IPredicate)
public final IAccessPath<E> getAccessPath(IKeyOrder<E> keyOrder, IPredicate<E> predicate)
IRelation
getAccessPath
in interface IRelation<E>
keyOrder
- Identifies which index to use (required).predicate
- The predicate (required).IAccessPath
.IRelation.getAccessPath(IIndexManager, IKeyOrder, IPredicate)
public final IAccessPath<E> getAccessPath(IIndexManager localIndexManager, IKeyOrder<E> keyOrder, IPredicate<E> predicate)
IRelation
IAccessPath
for an IRelation
using the
specified IIndexManager
and IKeyOrder
(core impl).
AccessPath
is responsible for
interpreting the following IPredicate
IPredicate#Annotations
:
IPredicate.Annotations#ACCESS_PATH_EXPANDER
IIndexManager
when running against a standalone
database. That IIndexManager
is available from
IRelation.getIndexManager()
.
Scale-out operators
which are
BOpEvaluationContext.SHARDED
or
BOpEvaluationContext.HASHED
require access to the local index
manager on the data service and signal this using:
BOpEvaluationContext.SHARDED
or
BOpEvaluationContext.HASHED
(on a join); andIPredicate.Annotations#PARTITION_ID
(for a shard-wise
access path).
Scale-out operators
MAY use remote access paths and signal
this using:
BOpEvaluationContext.ANY
(on a join); andIPredicate.Annotations#REMOTE_ACCESS_PATH
to
true
.IRelation.getIndexManager()
is used to obtain the
IBigdataFederation
from which the IRelation
definition
was materialized.getAccessPath
in interface IRelation<E>
localIndexManager
- The local index manager (optional).keyOrder
- Identifies which index to use (required).predicate
- The predicate (required).IAccessPath
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.