You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by GitBox <gi...@apache.org> on 2019/09/16 15:32:30 UTC

[GitHub] [trafodion] DaveBirdsall commented on a change in pull request #1856: [TRAFODION-3325] Pass down index hints for non-VEG equality predicates

DaveBirdsall commented on a change in pull request #1856: [TRAFODION-3325] Pass down index hints for non-VEG equality predicates
URL: https://github.com/apache/trafodion/pull/1856#discussion_r324742276
 
 

 ##########
 File path: core/sql/optimizer/RelExpr.cpp
 ##########
 @@ -1434,6 +1449,44 @@ void RelExpr::pushdownCoveredExpr(const ValueIdSet & outputExpr,
       computeValuesReqdForPredicates(predicatesOnParent,
                                      exprToEvalOnParent);
 
+      // -----------------------------------------------------------------
+      // Check for equality predicates that could not be pushed down.
+      // This may happen if we have an equality predicate that was not
+      // transformed into a VEG predicate. 
+      //
+      // If there are column references in the equality predicate, it
+      // may prove useful to tell the leaf nodes about it, as the equality
+      // predicate might be pushed down later during a Join to TSJ 
+      // transformation. Telling the leaf nodes about it might allow the
+      // use of an index in this case (see Scan::addIndexInfo; this is
+      // called once at the beginning of optimization, before any Join
+      // to TSJ transformations have been attempted).
+      // -----------------------------------------------------------------
+      ValueId pred;
+      for (pred = predicatesOnParent.init();
+           predicatesOnParent.next(pred);
+           predicatesOnParent.advance(pred))
+        {
+          ItemExpr * ie = pred.getItemExpr();
+          if (ie->getOperatorType() == ITM_EQUAL) // non-VEG, equality predicate
+            {
+              for (iter = firstChild; iter < lastChild; iter++)
+                {
+                  for (CollIndex i = 0; i < ie->getArity(); i++)
+                    {
+                      // If the child is covered, it might contain a column reference
+                      // that is useful for index selection. Push that down.
+                      ItemExpr * ieChildi = ie->child(i);
+                      if ((CmpCommon::getDefault(COMP_BOOL_194) == DF_ON) &&
+                          (coveredSubExprNotUsed[iter].contains(ieChildi->getValueId())))
 
 Review comment:
   Will do. Thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services