Package org.olap4cloud.impl

Examples of org.olap4cloud.impl.AggregationCubeDescriptor


    String methodName = "executeQuery() ";
    try {
      if(logger.isDebugEnabled()) logger.debug(methodName + "cubeDescriptor = "
          + cubeDescriptor.toString());
      List<String> usedDimensions = getUsedDimensions(query);
      AggregationCubeDescriptor aggCube = getBestAggregationCube(usedDimensions, cubeDescriptor);
      if(aggCube == null) {
        if(logger.isDebugEnabled()) logger.debug(methodName + "can't find aggregation cube. " +
            "Use data cube instead");
        CubeScan scan = getCubeScan(query, cubeDescriptor);
        return CubeScanMR.scan(scan, cubeDescriptor);
      } else {
        if(logger.isDebugEnabled()) logger.debug(methodName + " use aggregation cube "
            + aggCube.getCubeName());
        aggregateMeasures(query);
        CubeScan scan = getCubeScan(query, aggCube);
        return CubeScanMR.scan(scan, aggCube);
      }
    } catch(Exception e) {
View Full Code Here


    }
  }

  private AggregationCubeDescriptor getBestAggregationCube(
      List<String> usedDimensions, CubeDescriptor dataCube) throws Exception {
    AggregationCubeDescriptor bestAggCube = null;
    for(AggregationCubeDescriptor aggCube: dataCube.getAggregationCubes()) {
      boolean dimNotFound = false;
      for(String dimName: usedDimensions)
        if(!aggCube.containsDimensions(dimName)) {
          dimNotFound = true;
          break;
        }
      if(!dimNotFound && (bestAggCube == null || bestAggCube.getDimensions().size()
          > aggCube.getDimensions().size()))
        bestAggCube = aggCube;
    }
    return bestAggCube;
  }
View Full Code Here

      return;
    if(curDimension >= getDimensions().size())
      return;
    dimensionIndexes.add(curDimension);
    if(dimensionIndexes.size() == numberOfDimensions) {
      AggregationCubeDescriptor aggCubeDescriptor = new AggregationCubeDescriptor();
      StringBuilder aggCubeName = new StringBuilder(getCubeName());
      aggCubeName.append("_aggregate");
      for(CubeMeasure measure: getMeasures()) {
        aggCubeDescriptor.getAggregates().add(new SumCubeScanAggregate("sum(" + measure.getName() +
            ")", this));
        aggCubeDescriptor.getAggregates().add(new MinCubeScanAggregate("min(" + measure.getName() +
            ")", this));
        aggCubeDescriptor.getAggregates().add(new MaxCubeScanAggregate("max(" + measure.getName() +
            ")", this));
        aggCubeDescriptor.getAggregates().add(new CountCubeScanAggregate("count(" + measure.getName() +
            ")", this));
      }
      for(CubeScanAggregate aggregate: aggCubeDescriptor.getAggregates())
        aggCubeDescriptor.getMeasures().add(new CubeMeasure(aggregate.getColumnName() +
            "_" + aggregate.getAggregateName()));
      for(int i: dimensionIndexes)
        aggCubeDescriptor.getDimensions().add(new CubeDimension(getDimensions().get(i).getName()));
      for(CubeDimension dimension: aggCubeDescriptor.getDimensions())
        aggCubeName.append("_" + dimension.getName());
      aggCubeDescriptor.setCubeName(aggCubeName.toString());
      getAggregationCubes().add(aggCubeDescriptor);
      dimensionIndexes.remove(dimensionIndexes.size() - 1);
      return;
    }
    for(int nextDimension = curDimension + 1; nextDimension < getDimensions().size(); nextDimension ++)
View Full Code Here

TOP

Related Classes of org.olap4cloud.impl.AggregationCubeDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.