com.amazon.carbonado.qe
Class JoinedQueryExecutor<S extends Storable,T extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.qe.AbstractQueryExecutor<T>
      extended by com.amazon.carbonado.qe.JoinedQueryExecutor<S,T>
Type Parameters:
S - source type
T - target type
All Implemented Interfaces:
QueryExecutor<T>

public class JoinedQueryExecutor<S extends Storable,T extends Storable>
extends AbstractQueryExecutor<T>

QueryExecutor which joins a source and target executor, producing results of target type. The source executor is called once per fetch (outer loop), but the target executor is called once per source result (inner loop).

Author:
Brian S O'Neill

Method Summary
static
<T extends Storable>
QueryExecutor<T>
build(RepositoryAccess repoAccess, ChainedProperty<T> targetToSourceProperty, Filter<T> targetFilter, OrderingList<T> targetOrdering, QueryHints hints)
          Builds and returns a complex joined excutor against a chained property, supporting multi-way joins.
 Cursor<T> fetch(FilterValues<T> values)
          Returns a new cursor using the given filter values.
 Filter<T> getFilter()
          Returns the filter used by this QueryExecutor.
 OrderingList<T> getOrdering()
          Returns the result ordering of this QueryExecutor.
 boolean printPlan(Appendable app, int indentLevel, FilterValues<T> values)
          Prints the query plan to any appendable, if applicable.
 
Methods inherited from class com.amazon.carbonado.qe.AbstractQueryExecutor
count, fetchSlice, getStorableType, increaseIndent, indent, newline, printNative
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

build

public static <T extends Storable> QueryExecutor<T> build(RepositoryAccess repoAccess,
                                                          ChainedProperty<T> targetToSourceProperty,
                                                          Filter<T> targetFilter,
                                                          OrderingList<T> targetOrdering,
                                                          QueryHints hints)
                                               throws RepositoryException
Builds and returns a complex joined excutor against a chained property, supporting multi-way joins. Filtering and ordering may also be supplied, in order to better distribute work throughout the join.

Parameters:
repoAccess - used to create query executors for outer and inner loops
targetToSourceProperty - join property of target type which maps to instances of source type
targetFilter - optional filter for fetching target instances
targetOrdering - optional ordering to apply to target executor & @param hints optional hints
Throws:
IllegalArgumentException - if any parameter is null or if join property is not a Storable type
RepositoryException - from RepositoryAccess

fetch

public Cursor<T> fetch(FilterValues<T> values)
                                 throws FetchException
Description copied from interface: QueryExecutor
Returns a new cursor using the given filter values.

Throws:
FetchException

getFilter

public Filter<T> getFilter()
Description copied from interface: QueryExecutor
Returns the filter used by this QueryExecutor.

Returns:
query filter, never null

getOrdering

public OrderingList<T> getOrdering()
Description copied from interface: QueryExecutor
Returns the result ordering of this QueryExecutor.

Returns:
query ordering in an unmodifiable list

printPlan

public boolean printPlan(Appendable app,
                         int indentLevel,
                         FilterValues<T> values)
                  throws IOException
Description copied from interface: QueryExecutor
Prints the query plan to any appendable, if applicable.

values - optional
Returns:
false if not implemented
Throws:
IOException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.