Example #1
0
 /**
  * This method logs the reason for which we cannot apply the rewrite optimization.
  *
  * @return
  */
 boolean checkIfAllRewriteCriteriaIsMet(RewriteCanApplyCtx canApplyCtx) {
   if (canApplyCtx.getAggFuncCnt() > 1) {
     LOG.debug("More than 1 agg funcs: " + "Not supported by " + getName() + " optimization.");
     return false;
   }
   if (canApplyCtx.isAggFuncIsNotCount()) {
     LOG.debug(
         "Agg func other than count is " + "not supported by " + getName() + " optimization.");
     return false;
   }
   if (canApplyCtx.isCountOnAllCols()) {
     LOG.debug(
         "Currently count function needs group by on key columns. This is a count(*) case.,"
             + "Cannot apply this "
             + getName()
             + " optimization.");
     return false;
   }
   if (canApplyCtx.isCountOfOne()) {
     LOG.debug(
         "Currently count function needs group by on key columns. This is a count(1) case.,"
             + "Cannot apply this "
             + getName()
             + " optimization.");
     return false;
   }
   if (canApplyCtx.isAggFuncColsFetchException()) {
     LOG.debug(
         "Got exception while locating child col refs "
             + "of agg func, skipping "
             + getName()
             + " optimization.");
     return false;
   }
   if (canApplyCtx.isWhrClauseColsFetchException()) {
     LOG.debug(
         "Got exception while locating child col refs for where clause, "
             + "skipping "
             + getName()
             + " optimization.");
     return false;
   }
   if (canApplyCtx.isSelClauseColsFetchException()) {
     LOG.debug(
         "Got exception while locating child col refs for select list, "
             + "skipping "
             + getName()
             + " optimization.");
     return false;
   }
   if (canApplyCtx.isGbyKeysFetchException()) {
     LOG.debug(
         "Got exception while locating child col refs for GroupBy key, "
             + "skipping "
             + getName()
             + " optimization.");
     return false;
   }
   return true;
 }