protected class JoinTask.BindingSetConsumerTask extends Object implements Callable<Void>
IBindingSet
in each chunk, an JoinTask.AccessPathTask
is
created which will consume that IBindingSet
. The
JoinTask.AccessPathTask
for a given source chunk are sorted based on
their fromKey
so as to order the execution of those
tasks in a manner that will maximize the efficiency of index reads.
The ordered JoinTask.AccessPathTask
s are then submitted to the
caller's Executor
.Constructor and Description |
---|
JoinTask.BindingSetConsumerTask(Executor executor) |
Modifier and Type | Method and Description |
---|---|
Void |
call()
Read chunks from one or more sources until canceled,
interrupted, or all sources are exhausted and submits
JoinTask.AccessPathTask s to the caller's ExecutorService
-or- executes those tasks in the caller's thread if no
ExecutorService was provided to the ctor. |
protected Map<IPredicate<?>,Collection<IBindingSet>> |
combineBindingSets(IBindingSet[] chunk)
Populates a map of asBound predicates paired to a set of
bindingSets.
|
protected void |
executeTasks(JoinTask.AccessPathTask[] tasks)
Either execute the tasks in the caller's thread or schedule them
for execution on the supplied service.
|
protected JoinTask.AccessPathTask[] |
getAccessPathTasks(Map<IPredicate<?>,Collection<IBindingSet>> map)
Creates an
JoinTask.AccessPathTask for each IBindingSet in
the given chunk. |
protected void |
reorderTasks(JoinTask.AccessPathTask[] tasks)
The tasks are ordered based on the fromKey for the
associated
IAccessPath as licensed by each
IBindingSet . |
public JoinTask.BindingSetConsumerTask(Executor executor)
executor
- The service that will execute the generated
JoinTask.AccessPathTask
s -or- null
IFF
you want the JoinTask.AccessPathTask
s to be executed
in the caller's thread.public Void call() throws Exception
JoinTask.AccessPathTask
s to the caller's ExecutorService
-or- executes those tasks in the caller's thread if no
ExecutorService
was provided to the ctor.
Note: When running with an ExecutorService
, the caller
is responsible for waiting on that ExecutorService
until
the JoinTask.AccessPathTask
s to complete and must verify all
tasks completed successfully.
call
in interface Callable<Void>
null
BufferClosedException
- if there is an attempt to output a chunk of
IBindingSet
s or ISolution
s and the
output buffer is an IBlockingBuffer
(true for
all join dimensions exception the lastJoin and also
true for query on the lastJoin) and that
IBlockingBuffer
has been closed.Exception
protected Map<IPredicate<?>,Collection<IBindingSet>> combineBindingSets(IBindingSet[] chunk)
Note: The JoinTask.AccessPathTask
will apply each bindingSet to
each element visited by the IAccessPath
obtained for the
asBound IPredicate
. This has the natural consequence of
eliminating subqueries within the chunk.
chunk
- A chunk of bindingSets from the source join dimension.protected JoinTask.AccessPathTask[] getAccessPathTasks(Map<IPredicate<?>,Collection<IBindingSet>> map)
JoinTask.AccessPathTask
for each IBindingSet
in
the given chunk.chunk
- A chunk of IBindingSet
s from one or more
source JoinTask
s.JoinTask.AccessPathTask
in a desirable
execution order.Exception
protected void reorderTasks(JoinTask.AccessPathTask[] tasks)
IAccessPath
as licensed by each
IBindingSet
. This order tends to focus the reads on the
same parts of the index partitions with a steady progression in
the fromKey as we process a chunk of IBindingSet
s.tasks
- The tasks.protected void executeTasks(JoinTask.AccessPathTask[] tasks) throws Exception
tasks
- The tasks.Exception
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.