org.apache.lens.server.api.driver
Class DriverQueryPlan

java.lang.Object
  extended by org.apache.lens.server.api.driver.DriverQueryPlan

public abstract class DriverQueryPlan
extends Object

The Class DriverQueryPlan.


Nested Class Summary
static class DriverQueryPlan.ExecMode
          The Enum ExecMode.
static class DriverQueryPlan.ScanMode
          The Enum ScanMode.
 
Field Summary
protected  DriverQueryPlan.ExecMode execMode
          The exec mode.
protected  Double filterWeight
          The filter weight.
protected  Double gbyWeight
          The gby weight.
protected  QueryPrepareHandle handle
          The handle.
protected  boolean hasSubQuery
          The has sub query.
protected  Double havingWeight
          The having weight.
protected  Double joinWeight
          The join weight.
protected  int numAggrExprs
          The num aggr exprs.
protected  int numFilters
          The num filters.
protected  int numGbys
          The num gbys.
protected  int numHaving
          The num having.
protected  int numJoins
          The num joins.
protected  int numObys
          The num obys.
protected  int numSelDi
          The num sel di.
protected  int numSels
          The num sels.
protected  Double obyWeight
          The oby weight.
protected  String resultDestination
          The result destination.
protected  DriverQueryPlan.ScanMode scanMode
          The scan mode.
protected  Double selectWeight
          The select weight.
protected  List<String> tablesQueried
          The tables queried.
protected  Map<String,Double> tableWeights
          The table weights.
 
Constructor Summary
DriverQueryPlan()
           
 
Method Summary
protected  void addTablesQueries(String table)
          Set the list of table names to be queried.
abstract  QueryCost getCost()
          Get the cost associated with the plan
 DriverQueryPlan.ExecMode getExecMode()
          Get the exec mode
 Double getFilterWeight()
          Set the weight associated with filter expressions.
 Double getGbyWeight()
          Set the weight associated with group by expressions.
 QueryHandle getHandle()
          Deprecated.  
 Double getHavingWeight()
          Set the weight associated with having expressions.
 Double getJoinWeight()
          Get the weight associated with joins
 int getNumAggreagateExprs()
           
 int getNumFilters()
          Get the number of filters in query
 int getNumGbys()
          Get the number of group by expressions on query
 int getNumHaving()
          Get the number of having expressions on query
 int getNumJoins()
          Get number of joins in the query
 int getNumOrderBys()
          Get the number of order by expressions on query
 int getNumSelDistincts()
          Get the number distinct select expressions
 int getNumSels()
          Get the number of select expressions
 Double getObyWeight()
          Get the weight associated with order by expressions.
 Map<String,List<String>> getPartitions()
          Get list of partitions queried for each table
abstract  String getPlan()
          Get the query plan
 QueryPrepareHandle getPrepareHandle()
           
 String getResultDestination()
          Get the result destination
 DriverQueryPlan.ScanMode getScanMode()
          Get the scan mode.
 Double getSelectWeight()
          Get the weight associated with select expressions.
 List<String> getTablesQueried()
          Get the list of tables to be queried
 Double getTableWeight(String tableName)
          Get the weight of the table.
 Map<String,Double> getTableWeights()
          Get the table weights
 boolean hasSubQuery()
          Get if the query has a subquery or not.
protected  void setExecMode(DriverQueryPlan.ExecMode execMode)
          Set the exec mode
protected  void setFilterWeight(Double filterWeight)
          Set the weight associated with filter expressions.
protected  void setGbyWeight(Double gbyWeight)
          Set the weight associated with group by expressions.
protected  void setHasSubQuery()
          Set if query has subquery.
protected  void setHavingWeight(Double havingWeight)
          Set the weight associated with having expressions.
protected  void setJoinWeight(Double joinWeight)
          Set the weight associated with joins
protected  void setNumFilters(int numFilters)
          Set the number of filters in query
protected  void setNumGbys(int numGbys)
          Set the number of groupbys
protected  void setNumHaving(int numHaving)
          Set the number of having expressions on query
protected  void setNumJoins(int numJoins)
          Set the number of join expressions on query
protected  void setNumOrderBys(int numObys)
          Set the number of order by expressions on query
protected  void setNumSelDistincts(int numSelDi)
          Set the number of distinct select expressions
protected  void setNumSels(int numSels)
          Set the number of select expressions
protected  void setObyWeight(Double obyWeight)
          Set the weight associated with order by expressions.
 void setPrepareHandle(QueryPrepareHandle handle)
           
protected  void setResultDestination(String resultDestination)
          Set string representation of the destination
protected  void setScanMode(DriverQueryPlan.ScanMode scanMode)
          Set the scan mode
protected  void setSelectWeight(Double selectWeight)
          Set the weight associated with select expressions.
protected  void setTableWeight(String tableName, Double tableWeight)
          Set the weight of the table.
 QueryPlan toQueryPlan()
          To query plan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numJoins

protected int numJoins
The num joins.


numGbys

protected int numGbys
The num gbys.


numSels

protected int numSels
The num sels.


numSelDi

protected int numSelDi
The num sel di.


numHaving

protected int numHaving
The num having.


numObys

protected int numObys
The num obys.


numAggrExprs

protected int numAggrExprs
The num aggr exprs.


numFilters

protected int numFilters
The num filters.


tablesQueried

protected final List<String> tablesQueried
The tables queried.


hasSubQuery

protected boolean hasSubQuery
The has sub query.


resultDestination

protected String resultDestination
The result destination.


execMode

protected DriverQueryPlan.ExecMode execMode
The exec mode.


scanMode

protected DriverQueryPlan.ScanMode scanMode
The scan mode.


tableWeights

protected final Map<String,Double> tableWeights
The table weights.


joinWeight

protected Double joinWeight
The join weight.


gbyWeight

protected Double gbyWeight
The gby weight.


filterWeight

protected Double filterWeight
The filter weight.


havingWeight

protected Double havingWeight
The having weight.


obyWeight

protected Double obyWeight
The oby weight.


selectWeight

protected Double selectWeight
The select weight.


handle

protected QueryPrepareHandle handle
The handle.

Constructor Detail

DriverQueryPlan

public DriverQueryPlan()
Method Detail

getPlan

public abstract String getPlan()
Get the query plan

Returns:
The string representation of the plan

getCost

public abstract QueryCost getCost()
Get the cost associated with the plan

Returns:
QueryCost object

getNumGbys

public int getNumGbys()
Get the number of group by expressions on query

Returns:
the numGbys

setNumGbys

protected void setNumGbys(int numGbys)
Set the number of groupbys

Parameters:
numGbys - the numGbys to set

getNumSels

public int getNumSels()
Get the number of select expressions

Returns:
the numSels

setNumSels

protected void setNumSels(int numSels)
Set the number of select expressions

Parameters:
numSels - the numSels to set

getNumSelDistincts

public int getNumSelDistincts()
Get the number distinct select expressions

Returns:
the numSelDi

setNumSelDistincts

protected void setNumSelDistincts(int numSelDi)
Set the number of distinct select expressions

Parameters:
numSelDi - the numSelDi to set

getNumJoins

public int getNumJoins()
Get number of joins in the query

Returns:
the numJoins

setNumJoins

protected void setNumJoins(int numJoins)
Set the number of join expressions on query

Parameters:
numJoins - the numJoins to set

getNumHaving

public int getNumHaving()
Get the number of having expressions on query

Returns:
the numHaving

setNumHaving

protected void setNumHaving(int numHaving)
Set the number of having expressions on query

Parameters:
numHaving - the numHaving to set

getNumOrderBys

public int getNumOrderBys()
Get the number of order by expressions on query

Returns:
the numObys

setNumOrderBys

protected void setNumOrderBys(int numObys)
Set the number of order by expressions on query

Parameters:
numObys - the numObys to set

getTablesQueried

public List<String> getTablesQueried()
Get the list of tables to be queried

Returns:
the tablesQueried

addTablesQueries

protected void addTablesQueries(String table)
Set the list of table names to be queried.

Parameters:
table - the table

getNumFilters

public int getNumFilters()
Get the number of filters in query

Returns:
the numFilters

setNumFilters

protected void setNumFilters(int numFilters)
Set the number of filters in query

Parameters:
numFilters - the numFilters to set

hasSubQuery

public boolean hasSubQuery()
Get if the query has a subquery or not.

Returns:
the hasSubQuery true if query has subquery, false otherwise

setHasSubQuery

protected void setHasSubQuery()
Set if query has subquery.


getResultDestination

public String getResultDestination()
Get the result destination

Returns:
the resultDestination The destination can be another table or filesystem path or inmemory result

setResultDestination

protected void setResultDestination(String resultDestination)
Set string representation of the destination

Parameters:
resultDestination - the resultDestination to set

getTableWeights

public Map<String,Double> getTableWeights()
Get the table weights

Returns:
the tableWeights

getTableWeight

public Double getTableWeight(String tableName)
Get the weight of the table.

Parameters:
tableName - the table name
Returns:
the weight

setTableWeight

protected void setTableWeight(String tableName,
                              Double tableWeight)
Set the weight of the table.

Parameters:
tableName - The name of the table.
tableWeight - Weight of the table being queried. This should reflect the amount of data being read/scanned from the table, scan cost

getExecMode

public DriverQueryPlan.ExecMode getExecMode()
Get the exec mode

Returns:
the DriverQueryPlan.ExecMode

setExecMode

protected void setExecMode(DriverQueryPlan.ExecMode execMode)
Set the exec mode

Parameters:
execMode - the DriverQueryPlan.ExecMode to set

getScanMode

public DriverQueryPlan.ScanMode getScanMode()
Get the scan mode.

Returns:
the DriverQueryPlan.ScanMode

setScanMode

protected void setScanMode(DriverQueryPlan.ScanMode scanMode)
Set the scan mode

Parameters:
scanMode - the DriverQueryPlan.ScanMode to set

getJoinWeight

public Double getJoinWeight()
Get the weight associated with joins

Returns:
the joinWeight

setJoinWeight

protected void setJoinWeight(Double joinWeight)
Set the weight associated with joins

Parameters:
joinWeight - the joinWeight to set

getGbyWeight

public Double getGbyWeight()
Set the weight associated with group by expressions.

Returns:
the gbyWeight

setGbyWeight

protected void setGbyWeight(Double gbyWeight)
Set the weight associated with group by expressions.

Parameters:
gbyWeight - the gbyWeight to set

getFilterWeight

public Double getFilterWeight()
Set the weight associated with filter expressions.

Returns:
the filterWeight

setFilterWeight

protected void setFilterWeight(Double filterWeight)
Set the weight associated with filter expressions.

Parameters:
filterWeight - the filterWeight to set

getObyWeight

public Double getObyWeight()
Get the weight associated with order by expressions.

Returns:
the obyWeight

setObyWeight

protected void setObyWeight(Double obyWeight)
Set the weight associated with order by expressions.

Parameters:
obyWeight - the obyWeight to set

getHavingWeight

public Double getHavingWeight()
Set the weight associated with having expressions.

Returns:
the havingWeight

setHavingWeight

protected void setHavingWeight(Double havingWeight)
Set the weight associated with having expressions.

Parameters:
havingWeight - the havingWeight to set

getSelectWeight

public Double getSelectWeight()
Get the weight associated with select expressions.

Returns:
the selectWeight

setSelectWeight

protected void setSelectWeight(Double selectWeight)
Set the weight associated with select expressions.

Parameters:
selectWeight - the selectWeight to set

getHandle

public QueryHandle getHandle()
Deprecated. 

Returns:
the handle

getPrepareHandle

public QueryPrepareHandle getPrepareHandle()
Returns:
the prepare handle

setPrepareHandle

public void setPrepareHandle(QueryPrepareHandle handle)
Parameters:
handle - the handle to set

getNumAggreagateExprs

public int getNumAggreagateExprs()

getPartitions

public Map<String,List<String>> getPartitions()
Get list of partitions queried for each table

Returns:

toQueryPlan

public QueryPlan toQueryPlan()
                      throws UnsupportedEncodingException
To query plan.

Returns:
the query plan
Throws:
UnsupportedEncodingException - the unsupported encoding exception


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.