org.teiid.query.optimizer.relational.rules
Class NewCalculateCostUtil

java.lang.Object
  extended by org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil

public class NewCalculateCostUtil
extends java.lang.Object

Since:
4.3

Nested Class Summary
static class NewCalculateCostUtil.DependentCostAnalysis
           
 
Field Summary
static int UNKNOWN_JOIN_SCALING
           
static float UNKNOWN_VALUE
           
 
Constructor Summary
NewCalculateCostUtil()
           
 
Method Summary
static NewCalculateCostUtil.DependentCostAnalysis computeCostForDepJoin(PlanNode joinNode, boolean leftIndependent, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context)
          Computes the cost of a Dependent Join The worst possible cost will arise from a high independent ndv (many dependent sets) and a low dependent ndv (possibly many matches per set) This logic uses the same assumption as criteria in that ndv is used as a divisor of cardinality.
static NewCalculateCostUtil.DependentCostAnalysis computeCostForDepJoin(PlanNode independentNode, PlanNode dependentNode, java.util.List independentExpressions, java.util.List dependentExpressions, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context)
           
static java.lang.Object getKeyUsed(java.util.Collection<? extends SingleElementSymbol> allElements, java.util.Set<GroupSymbol> groups, QueryMetadataInterface metadata, java.lang.Boolean unique)
           
static boolean usesKey(java.util.Collection<? extends SingleElementSymbol> allElements, QueryMetadataInterface metadata)
          TODO: this uses key check is not really accurate, it doesn't take into consideration where we are in the plan.
static boolean usesKey(java.util.Collection<? extends SingleElementSymbol> allElements, java.util.Set<GroupSymbol> groups, QueryMetadataInterface metadata, boolean unique)
           
static boolean usesKey(Criteria crit, QueryMetadataInterface metadata)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_JOIN_SCALING

public static final int UNKNOWN_JOIN_SCALING
See Also:
Constant Field Values

UNKNOWN_VALUE

public static final float UNKNOWN_VALUE
See Also:
Constant Field Values
Constructor Detail

NewCalculateCostUtil

public NewCalculateCostUtil()
Method Detail

usesKey

public static boolean usesKey(Criteria crit,
                              QueryMetadataInterface metadata)
                       throws QueryMetadataException,
                              TeiidComponentException
Throws:
QueryMetadataException
TeiidComponentException

usesKey

public static boolean usesKey(java.util.Collection<? extends SingleElementSymbol> allElements,
                              QueryMetadataInterface metadata)
                       throws QueryMetadataException,
                              TeiidComponentException
TODO: this uses key check is not really accurate, it doesn't take into consideration where we are in the plan. if a key column is used after a non 1-1 join or a union all, then it may be non-unique.

Throws:
QueryMetadataException
TeiidComponentException

usesKey

public static boolean usesKey(java.util.Collection<? extends SingleElementSymbol> allElements,
                              java.util.Set<GroupSymbol> groups,
                              QueryMetadataInterface metadata,
                              boolean unique)
                       throws QueryMetadataException,
                              TeiidComponentException
Throws:
QueryMetadataException
TeiidComponentException

getKeyUsed

public static java.lang.Object getKeyUsed(java.util.Collection<? extends SingleElementSymbol> allElements,
                                          java.util.Set<GroupSymbol> groups,
                                          QueryMetadataInterface metadata,
                                          java.lang.Boolean unique)
                                   throws QueryMetadataException,
                                          TeiidComponentException
Throws:
QueryMetadataException
TeiidComponentException

computeCostForDepJoin

public static NewCalculateCostUtil.DependentCostAnalysis computeCostForDepJoin(PlanNode joinNode,
                                                                               boolean leftIndependent,
                                                                               QueryMetadataInterface metadata,
                                                                               CapabilitiesFinder capFinder,
                                                                               CommandContext context)
                                                                        throws TeiidComponentException,
                                                                               QueryMetadataException,
                                                                               QueryPlannerException
Computes the cost of a Dependent Join The worst possible cost will arise from a high independent ndv (many dependent sets) and a low dependent ndv (possibly many matches per set) This logic uses the same assumption as criteria in that ndv is used as a divisor of cardinality.

Throws:
QueryPlannerException
TeiidComponentException
QueryMetadataException

computeCostForDepJoin

public static NewCalculateCostUtil.DependentCostAnalysis computeCostForDepJoin(PlanNode independentNode,
                                                                               PlanNode dependentNode,
                                                                               java.util.List independentExpressions,
                                                                               java.util.List dependentExpressions,
                                                                               QueryMetadataInterface metadata,
                                                                               CapabilitiesFinder capFinder,
                                                                               CommandContext context)
                                                                        throws QueryMetadataException,
                                                                               TeiidComponentException,
                                                                               QueryPlannerException
Throws:
QueryMetadataException
TeiidComponentException
QueryPlannerException


Copyright © 2011. All Rights Reserved.