Package org.apache.metamodel.jdbc
Class QuerySplitter
- java.lang.Object
-
- org.apache.metamodel.jdbc.QuerySplitter
-
public final class QuerySplitter extends Object
The QuerySplitter class makes it possible to split up queries that are expected to yield a huge result set which may cause performance problems like OutOfMemoryError's or very long processing periods. The resulting queries will in union produce the same result, but in smaller bits (resultsets with less rows). Note that there is an initial performance-penalty associated with splitting the query since some queries will be executed in order to determine reasonable intervals to use for the resulting queries WHERE clauses.- See Also:
Query,DataContext
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MAX_ROWS
-
Constructor Summary
Constructors Constructor Description QuerySplitter(org.apache.metamodel.DataContext dc, org.apache.metamodel.query.Query q)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.metamodel.data.DataSetexecuteQueries()org.apache.metamodel.data.DataSetexecuteQueries(List<org.apache.metamodel.query.Query> splitQueries)longgetRowCount()static booleanisSplittable(org.apache.metamodel.query.Query q)QuerySplittersetMaxRows(long maxRows)Sets the desired maximum result set row count.List<org.apache.metamodel.query.Query>splitQuery()Splits the query into several queries that will together yield the same result set
-
-
-
Field Detail
-
DEFAULT_MAX_ROWS
public static final long DEFAULT_MAX_ROWS
- See Also:
- Constant Field Values
-
-
Method Detail
-
splitQuery
public List<org.apache.metamodel.query.Query> splitQuery()
Splits the query into several queries that will together yield the same result set- Returns:
- a list of queries that can be executed to yield the same collective result as this QuerySplitter's query
-
isSplittable
public static boolean isSplittable(org.apache.metamodel.query.Query q)
-
getRowCount
public long getRowCount()
- Returns:
- the total number of rows expected from executing the query.
-
setMaxRows
public QuerySplitter setMaxRows(long maxRows)
Sets the desired maximum result set row count. Note that this size cannot be guaranteed, but will serve as an indicator for determining the split-size- Parameters:
maxRows-
-
executeQueries
public org.apache.metamodel.data.DataSet executeQueries()
-
executeQueries
public org.apache.metamodel.data.DataSet executeQueries(List<org.apache.metamodel.query.Query> splitQueries)
-
-