Пример #1
0
 private HQLContextInterface createHQLContext(
     Set<CandidateFact> facts,
     Map<Dimension, CandidateDim> dimsToQuery,
     Map<CandidateFact, Set<Dimension>> factDimMap)
     throws LensException {
   if (facts == null || facts.size() == 0) {
     return new DimOnlyHQLContext(dimsToQuery, this, this);
   } else if (facts.size() == 1 && facts.iterator().next().getStorageTables().size() > 1) {
     // create single fact with multiple storage context
     return new SingleFactMultiStorageHQLContext(facts.iterator().next(), dimsToQuery, this, this);
   } else if (facts.size() == 1 && facts.iterator().next().getStorageTables().size() == 1) {
     // create single fact context
     return new SingleFactSingleStorageHQLContext(
         facts.iterator().next(), dimsToQuery, this, this);
   } else {
     return new MultiFactHQLContext(facts, dimsToQuery, factDimMap, this);
   }
 }
Пример #2
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();
     }
   }
 }
Пример #3
0
 String getQBFromString(CandidateFact fact, Map<Dimension, CandidateDim> dimsToQuery)
     throws LensException {
   String fromString;
   if (getJoinAST() == null) {
     if (cube != null) {
       if (dimensions.size() > 0) {
         throw new LensException(LensCubeErrorCode.NO_JOIN_CONDITION_AVAILABLE.getLensErrorInfo());
       }
       fromString = fact.getStorageString(getAliasForTableName(cube.getName()));
     } else {
       if (dimensions.size() != 1) {
         throw new LensException(LensCubeErrorCode.NO_JOIN_CONDITION_AVAILABLE.getLensErrorInfo());
       }
       Dimension dim = dimensions.iterator().next();
       fromString = dimsToQuery.get(dim).getStorageString(getAliasForTableName(dim.getName()));
     }
   } else {
     StringBuilder builder = new StringBuilder();
     getQLString(qb.getQbJoinTree(), builder, fact, dimsToQuery);
     fromString = builder.toString();
   }
   return fromString;
 }