[teiid-commits] teiid SVN: r3653 - in trunk/engine/src/main: java/org/teiid/query/optimizer/relational/rules and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Nov 15 13:20:17 EST 2011


Author: shawkins
Date: 2011-11-15 13:20:16 -0500 (Tue, 15 Nov 2011)
New Revision: 3653

Modified:
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
   trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
   trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1828 adding warning and more plan information related to dependent join backoff

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java	2011-11-15 18:10:51 UTC (rev 3652)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java	2011-11-15 18:20:16 UTC (rev 3653)
@@ -142,7 +142,8 @@
         EST_JOIN_COST,       // Float value that represents the estimated cost of a merge join (the join strategy for this could be Nested Loop or Merge)
         EST_CARDINALITY,     // Float represents the estimated cardinality (amount of rows) produced by this node
         EST_COL_STATS,
-        EST_SELECTIVITY,     // Float that represents the selectivity of a criteria node 
+        EST_SELECTIVITY,     // Float that represents the selectivity of a criteria node
+        MAX_NDV,			 // The max NDV before the dependent join will be aborted
         
         // Tuple limit and offset
         MAX_TUPLE_LIMIT,     // Expression that evaluates to the max number of tuples generated

Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java	2011-11-15 18:10:51 UTC (rev 3652)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java	2011-11-15 18:20:16 UTC (rev 3653)
@@ -326,11 +326,13 @@
             Expression indepExpr = (Expression) independentExpressions.get(i);
             DependentSetCriteria crit = new DependentSetCriteria(SymbolMap.getExpression(depExpr), id);
             float ndv = NewCalculateCostUtil.UNKNOWN_VALUE;
+            Float maxNdv = null;
             if (dca != null && dca.expectedNdv[i] != null) {
             	if (dca.expectedNdv[i] > 4*dca.maxNdv[i]) {
             		continue; //not necessary to use
             	}
             	ndv = dca.expectedNdv[i];
+            	maxNdv = dca.maxNdv[i];
             	crit.setMaxNdv(dca.maxNdv[i]);
             } else { 
 	            Collection<ElementSymbol> elems = ElementCollectorVisitor.getElements(indepExpr, true);
@@ -345,6 +347,9 @@
             PlanNode selectNode = RelationalPlanner.createSelectNode(crit, false);
             
             selectNode.setProperty(NodeConstants.Info.IS_DEPENDENT_SET, Boolean.TRUE);
+            if (maxNdv != null) {
+            	selectNode.setProperty(NodeConstants.Info.MAX_NDV, maxNdv);
+            }
             result.add(selectNode);
         }
         

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-11-15 18:10:51 UTC (rev 3652)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java	2011-11-15 18:20:16 UTC (rev 3653)
@@ -38,6 +38,9 @@
 import org.teiid.common.buffer.BlockedException;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.query.QueryPlugin;
 import org.teiid.query.optimizer.relational.rules.NewCalculateCostUtil;
 import org.teiid.query.processor.relational.SortUtility.Mode;
 import org.teiid.query.rewriter.QueryRewriter;
@@ -116,7 +119,8 @@
                     		}
                     		last = next;
                     	}
-                    	if (distinctCount > setState.maxNdv) {
+                    	if (!setState.overMax && distinctCount > setState.maxNdv) {
+                    		LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DependentCriteriaProcessor.dep_join_backoff", valueSource, setState.valueExpression, setState.maxNdv)); //$NON-NLS-1$
                     		setState.overMax = true;
                     	}
                     }

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-11-15 18:10:51 UTC (rev 3652)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2011-11-15 18:20:16 UTC (rev 3653)
@@ -944,4 +944,6 @@
 support_required=Without required support property {0}, pushdown will not be enabled for {1} on translator {2}.
 
 RuleAssignOutputElements.couldnt_push_expression=Expression(s) {0} cannot be pushed to source.
-RuleAssignOutputElements.cannot_introduce_expressions=Cannot introduce new expressions {1} in duplicate removal.
\ No newline at end of file
+RuleAssignOutputElements.cannot_introduce_expressions=Cannot introduce new expressions {1} in duplicate removal.
+
+DependentCriteriaProcessor.dep_join_backoff=Not performing dependent join using source {0}, since the number of distinct rows for expression {1} exceeds {2}.  You should ensure that your source statistics, including column distinct value counts, accurately reflect the source or use a MAKE_DEP hint to force the join. 
\ No newline at end of file



More information about the teiid-commits mailing list