public class QueryPlan extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QueryPlan.PredicateOperator |
Constructor and Description |
---|
QueryPlan(Database.Transaction transaction,
String startTableName)
Creates a new QueryPlan within transaction.
|
Modifier and Type | Method and Description |
---|---|
void |
average(String column)
Add an average on column.
|
void |
count()
Add a count aggregate to this query.
|
Iterator<Record> |
execute()
Generates a naïve QueryPlan in which all joins are at the bottom of the DAG followed by all where
predicates, an optional group by operator, and a set of selects (in that order).
|
void |
groupBy(String column)
Set the group by column for this query.
|
void |
join(String tableName,
String leftColumnName,
String rightColumnName)
Join the leftColumnName column of the existing queryplan against the rightColumnName column
of tableName.
|
void |
select(List<String> columnNames)
Add a select operator to the QueryPlan with a list of column names.
|
void |
sum(String column)
Add a sum on column.
|
void |
where(String column,
QueryPlan.PredicateOperator comparison,
DataBox value)
Add a where operator.
|
public QueryPlan(Database.Transaction transaction, String startTableName)
transaction
- the transaction containing this querystartTableName
- the source table for this querypublic void select(List<String> columnNames) throws QueryPlanException
columnNames
- the columns to selectQueryPlanException
public void where(String column, QueryPlan.PredicateOperator comparison, DataBox value) throws QueryPlanException
column
- the column to specify the predicate oncomparison
- the comparatorvalue
- the value to compare againstQueryPlanException
public void groupBy(String column) throws QueryPlanException
column
- the column to group byQueryPlanException
public void count() throws QueryPlanException
QueryPlanException
public void average(String column) throws QueryPlanException
column
- the column to averageQueryPlanException
public void sum(String column) throws QueryPlanException
column
- the column to sumQueryPlanException
public void join(String tableName, String leftColumnName, String rightColumnName)
tableName
- the table to join againstleftColumnName
- the join column in the existing QueryPlanrightColumnName
- the join column in tableNamepublic Iterator<Record> execute() throws DatabaseException, QueryPlanException
DatabaseException
QueryPlanException
Copyright © 2017. All rights reserved.