示例#1
0
 public void addDimPruningMsgs(
     Dimension dim, CubeDimensionTable dimtable, CandidateTablePruneCause msg) {
   PruneCauses<CubeDimensionTable> dimMsgs = dimPruningMsgs.get(dim);
   if (dimMsgs == null) {
     dimMsgs = new PruneCauses<CubeDimensionTable>();
     dimPruningMsgs.put(dim, dimMsgs);
   }
   dimMsgs.addPruningMsg(dimtable, msg);
 }
示例#2
0
 private Set<CandidateFact> pickCandidateFactToQuery() throws LensException {
   Set<CandidateFact> facts = null;
   if (hasCubeInQuery()) {
     if (candidateFactSets.size() > 0) {
       facts = candidateFactSets.iterator().next();
       log.info(
           "Available candidate facts:{}, picking up {} for querying", candidateFactSets, facts);
     } else {
       String reason = "";
       if (!factPruningMsgs.isEmpty()) {
         ByteArrayOutputStream out = null;
         try {
           ObjectMapper mapper = new ObjectMapper();
           out = new ByteArrayOutputStream();
           mapper.writeValue(out, factPruningMsgs.getJsonObject());
           reason = out.toString("UTF-8");
         } catch (Exception e) {
           throw new LensException("Error writing fact pruning messages", e);
         } finally {
           if (out != null) {
             try {
               out.close();
             } catch (IOException e) {
               throw new LensException(e);
             }
           }
         }
       }
       log.error(
           "Query rewrite failed due to NO_CANDIDATE_FACT_AVAILABLE, Cause {}",
           factPruningMsgs.toJsonObject());
       throw new NoCandidateFactAvailableException(factPruningMsgs);
     }
   }
   return facts;
 }
示例#3
0
 public void addFactPruningMsgs(CubeFactTable fact, CandidateTablePruneCause factPruningMsg) {
   log.info("Pruning fact {} with cause: {}", fact, factPruningMsg);
   factPruningMsgs.addPruningMsg(fact, factPruningMsg);
 }