예제 #1
0
 public void pruneCandidateFactWithCandidateSet(CandidateTablePruneCause pruneCause) {
   // remove candidate facts that are not part of any covering set
   Set<CandidateFact> allCoveringFacts = new HashSet<CandidateFact>();
   for (Set<CandidateFact> set : candidateFactSets) {
     allCoveringFacts.addAll(set);
   }
   for (Iterator<CandidateFact> i = candidateFacts.iterator(); i.hasNext(); ) {
     CandidateFact cfact = i.next();
     if (!allCoveringFacts.contains(cfact)) {
       log.info("Not considering fact table:{} as {}", cfact, pruneCause);
       addFactPruningMsgs(cfact.fact, pruneCause);
       i.remove();
     }
   }
 }
예제 #2
0
  public boolean isCubeMeasure(String col) {
    if (col == null) {
      return false;
    }

    col = col.trim();
    // Take care of brackets added around col names in HQLParsrer.getString
    if (col.startsWith("(") && col.endsWith(")") && col.length() > 2) {
      col = col.substring(1, col.length() - 1);
    }

    String[] split = StringUtils.split(col, ".");
    if (split.length <= 1) {
      col = col.trim().toLowerCase();
      if (queriedExprs.contains(col)) {
        return exprCtx
            .getExpressionContext(col, getAliasForTableName(cube.getName()))
            .hasMeasures();
      } else {
        return cube.getMeasureNames().contains(col);
      }
    } else {
      String cubeName = split[0].trim().toLowerCase();
      String colName = split[1].trim().toLowerCase();
      if (cubeName.equalsIgnoreCase(cube.getName())
          || cubeName.equals(getAliasForTableName(cube.getName()))) {
        if (queriedExprs.contains(colName)) {
          return exprCtx.getExpressionContext(colName, cubeName).hasMeasures();
        } else {
          return cube.getMeasureNames().contains(colName.toLowerCase());
        }
      } else {
        return false;
      }
    }
  }
예제 #3
0
 public boolean isAggregateExpr(String expr) {
   return aggregateExprs.contains(expr == null ? null : expr.toLowerCase());
 }