Examples of CubeScan


Examples of org.olap4cloud.impl.CubeScan

      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) {
      throw new OLAPEngineException(e);
    }
View Full Code Here

Examples of org.olap4cloud.impl.CubeScan

    return ret;
  }

  private CubeScan getCubeScan(CubeQuery query, CubeDescriptor cubeDescriptor) throws Exception{
    String methodName  = "getCubeScan() ";
    CubeScan scan = new CubeScan();
    List<CubeIndexEntry> index = null;
    for(CubeQueryCondition condition: query.getConditions()) {
      String dimensionName = condition.getDimensionName();
      if(logger.isDebugEnabled()) logger.debug(methodName + "process dimension " + dimensionName);
      int dimensionNumber = getDimensionNumber(dimensionName, cubeDescriptor);
      if(logger.isDebugEnabled()) logger.debug(methodName + "dimensionNumber = " + dimensionNumber);
      List<CubeIndexEntry> dimIndex = new ArrayList<CubeIndexEntry>();
      for(long dimVal: condition.dimensionValues) {
        List<CubeIndexEntry> dimValIndex = getIndexForDimensionValue(dimensionNumber, dimVal, cubeDescriptor);
        dimIndex = mergeIndexes(dimIndex, dimValIndex);
      }
      if(index == null)
        index = dimIndex;
      else
        index = joinIndexes(index, dimIndex);
      long values[] = new long[condition.getDimensionValues().size()];
      for(int i = 0; i < values.length; i ++)
        values[i] = condition.getDimensionValues().get(i);
      scan.getConditions().add(new CubeScanCondition(dimensionNumber, values));
    }
    if(logger.isDebugEnabled()) logger.debug(methodName + "final index size: " + index.size());
    for(CubeIndexEntry indexEntry: index) {
      byte startRow[] = getStartRow(indexEntry, cubeDescriptor.dimensions.size());
      byte stopRow[] = getStopRow(indexEntry, cubeDescriptor.dimensions.size());
      if(logger.isDebugEnabled()) logger.debug(methodName + "add range [" + LogUtils.describe(startRow)
          + ", " + LogUtils.describe(stopRow) + "]  to scan.");
      Pair<byte[], byte[]> range = new Pair<byte[], byte[]>(startRow, stopRow);
      scan.getRanges().add(range);
    }
    for(CubeQueryAggregate aggregate: query.getAggregates())
      scan.getCubeScanAggregates().add(getCubeScanAggregate(aggregate, cubeDescriptor));
    int groupBy[] = new int[query.getGroupBy().size()];
    for(int i = 0; i < groupBy.length; i ++)
      groupBy[i] = getDimensionNumber(query.getGroupBy().get(i), cubeDescriptor);
    scan.setGroupBy(groupBy);
    scan.prepare();
    return scan;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.