public abstract class AlgorithmImpl extends Object implements Algorithm
Algorithm
that uses an exhaustive
algorithm. The algorithm constructs the full lattice in memory, and uses a
greedy algorithm which, at each step, chooses the aggregate which offers
the greatest benefit over the current set of aggregates.
If there are N levels, then the lattice has size
2N. Let's suppose that the algorithm creates
M aggregates before each aggregate sees only a marginal benefit.
Then the running time is M * 2N.
The cost and memory usage of the algorithm is prohibitive for all but very small schemas. For example, for a schema with 20 levels and 40 aggregate tables, this requires memory for a lattice of 1 million potential aggregates, and 40 million steps to evaluate choose the actual set of aggregate tables.
Algorithm.CostBenefit, Algorithm.ParameterEnum| Modifier and Type | Field and Description |
|---|---|
protected List<Parameter> |
parameterList |
protected Schema |
schema |
| Modifier | Constructor and Description |
|---|---|
protected |
AlgorithmImpl()
Creates an AggregateTableAdvisorImpl
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels a run.
|
protected boolean |
checkCancelTimeout()
Checks whether this algorithm has been canceled or has exceeded its
maximum running time.
|
Aggregate |
createAggregate(Schema schema,
List<Attribute> attributeList)
Creates an Aggregate.
|
static String |
getBaseName(Class<? extends Component> aClass) |
String |
getName()
Returns a name for this component.
|
List<Parameter> |
getParameters()
Declares the parameters that this component accepts.
|
protected void |
onStart(Map<Parameter,Object> parameterValues,
Progress progress)
Called by the
Algorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress) method, resets the 'canceled' flag and
sets the start time for timeout purposes. |
protected ResultImpl |
runAlgorithm(Lattice lattice,
double costLimit,
double minCostBenefitRatio,
int aggregateLimit) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomputeAggregateCosts, runprotected Schema schema
public void cancel()
AlgorithmCall this method from another thread.
Some algorithms are able to return a result if they are canceled
before they run to completion; if so, the Algorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress) method will
return that result; otherwise Algorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress) returns null.
public String getName()
Componentpublic List<Parameter> getParameters()
ComponentgetParameters in interface Componentprotected void onStart(Map<Parameter,Object> parameterValues, Progress progress)
Algorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress) method, resets the 'canceled' flag and
sets the start time for timeout purposes.parameterValues - Parametersprogress - Progress callbackprotected boolean checkCancelTimeout()
Algorithm must call this method regularly and terminate if it returns true.
public Aggregate createAggregate(Schema schema, List<Attribute> attributeList)
AlgorithmcreateAggregate in interface Algorithmschema - Schema objectattributeList - List of attributesprotected ResultImpl runAlgorithm(Lattice lattice, double costLimit, double minCostBenefitRatio, int aggregateLimit)
Copyright © 2006–2016 Julian Hyde. All rights reserved.