com.amazon.carbonado.qe
Class UnionQueryExecutor<S extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.qe.AbstractQueryExecutor<S>
      extended by com.amazon.carbonado.qe.UnionQueryExecutor<S>
All Implemented Interfaces:
QueryExecutor<S>

public class UnionQueryExecutor<S extends Storable>
extends AbstractQueryExecutor<S>

QueryExecutor which wraps several others and unions the results.

Author:
Brian S O'Neill
See Also:
UnionCursor

Constructor Summary
UnionQueryExecutor(List<QueryExecutor<S>> executors)
           
UnionQueryExecutor(List<QueryExecutor<S>> executors, OrderingList<S> totalOrdering)
           
UnionQueryExecutor(QueryExecutor<S>... executors)
           
 
Method Summary
 Cursor<S> fetch(FilterValues<S> values)
          Returns a new cursor using the given filter values.
 Filter<S> getFilter()
          Returns the combined filter of the wrapped executors.
 OrderingList<S> getOrdering()
          Returns the result ordering of this QueryExecutor.
 boolean printNative(Appendable app, int indentLevel, FilterValues<S> values)
          Prints native queries of the wrapped executors.
 boolean printPlan(Appendable app, int indentLevel, FilterValues<S> 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionQueryExecutor

public UnionQueryExecutor(QueryExecutor<S>... executors)
Parameters:
executors - executors to wrap, each must have the exact same total ordering
Throws:
IllegalArgumentException - if any parameter is null or if ordering doesn't match

UnionQueryExecutor

public UnionQueryExecutor(List<QueryExecutor<S>> executors)
Parameters:
executors - executors to wrap, each must have the exact same total ordering
Throws:
IllegalArgumentException - if any executors is null or if ordering doesn't match

UnionQueryExecutor

public UnionQueryExecutor(List<QueryExecutor<S>> executors,
                          OrderingList<S> totalOrdering)
Parameters:
executors - executors to wrap, each must have the exact same total ordering
totalOrdering - effective total ordering of executors
Throws:
IllegalArgumentException - if executors is null
Method Detail

fetch

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

Throws:
FetchException

getFilter

public Filter<S> getFilter()
Returns the combined filter of the wrapped executors.

Returns:
query filter, never null

getOrdering

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

Returns:
query ordering in an unmodifiable list

printNative

public boolean printNative(Appendable app,
                           int indentLevel,
                           FilterValues<S> values)
                    throws IOException
Prints native queries of the wrapped executors.

Specified by:
printNative in interface QueryExecutor<S extends Storable>
Overrides:
printNative in class AbstractQueryExecutor<S extends Storable>
values - optional
Returns:
false if not implemented
Throws:
IOException

printPlan

public boolean printPlan(Appendable app,
                         int indentLevel,
                         FilterValues<S> 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.