コード例 #1
0
ファイル: BatchTestCase.java プロジェクト: sohu001/mondrian
  protected CellRequest createRequest(
      final String cube,
      final String measureName,
      final String[] tables,
      final String[] columns,
      final String[] values,
      CellRequestConstraint aggConstraint) {
    RolapStar.Measure starMeasure = getMeasure(cube, measureName);

    CellRequest request = createRequest(cube, measureName, tables, columns, values);
    final RolapStar star = starMeasure.getStar();

    request.addAggregateList(aggConstraint.getBitKey(star), aggConstraint.toPredicate(star));

    return request;
  }
コード例 #2
0
ファイル: BatchTestCase.java プロジェクト: sohu001/mondrian
 protected CellRequest createRequest(
     final String cube,
     final String measureName,
     final String[] tables,
     final String[] columns,
     final String[] values) {
   RolapStar.Measure starMeasure = getMeasure(cube, measureName);
   CellRequest request = new CellRequest(starMeasure, false, false);
   final RolapStar star = starMeasure.getStar();
   for (int i = 0; i < tables.length; i++) {
     String table = tables[i];
     if (table != null && table.length() > 0) {
       String column = columns[i];
       String value = values[i];
       final RolapStar.Column storeTypeColumn = star.lookupColumn(table, column);
       request.addConstrainedColumn(
           storeTypeColumn, new ValueColumnPredicate(storeTypeColumn, value));
     }
   }
   return request;
 }
コード例 #3
0
    public PeekResponse call() {
      final RolapStar.Measure measure = request.getMeasure();
      final RolapStar star = measure.getStar();
      final RolapSchema schema = star.getSchema();
      final AggregationKey key = new AggregationKey(request);
      final List<SegmentHeader> headers =
          indexRegistry
              .getIndex(star)
              .locate(
                  schema.getName(),
                  schema.getChecksum(),
                  measure.getCubeName(),
                  measure.getName(),
                  star.getFactTable().getAlias(),
                  request.getConstrainedColumnsBitKey(),
                  request.getMappedCellValues(),
                  AggregationKey.getCompoundPredicateStringList(
                      star, key.getCompoundPredicateList()));

      final Map<SegmentHeader, Future<SegmentBody>> headerMap =
          new HashMap<SegmentHeader, Future<SegmentBody>>();
      final Map<List, SegmentBuilder.SegmentConverter> converterMap =
          new HashMap<List, SegmentBuilder.SegmentConverter>();

      // Is there a pending segment? (A segment that has been created and
      // is loading via SQL.)
      for (final SegmentHeader header : headers) {
        final Future<SegmentBody> bodyFuture = indexRegistry.getIndex(star).getFuture(header);
        if (bodyFuture != null) {
          // Check if the DataSourceChangeListener wants us to clear
          // the current segment
          if (star.getChangeListener() != null
              && star.getChangeListener().isAggregationChanged(key)) {
            /*
             * We can't satisfy this request, and we must clear the
             * data from our cache. We clear it from the index
             * first, then queue up a job in the background
             * to remove the data from all the caches.
             */
            indexRegistry.getIndex(star).remove(header);
            Util.safeGet(
                cacheExecutor.submit(
                    new Runnable() {
                      public void run() {
                        try {
                          compositeCache.remove(header);
                        } catch (Throwable e) {
                          LOGGER.warn("remove header failed: " + header, e);
                        }
                      }
                    }),
                "SegmentCacheManager.peek");
          }
          converterMap.put(
              SegmentCacheIndexImpl.makeConverterKey(header), getConverter(star, header));
          headerMap.put(header, bodyFuture);
        }
      }

      return new PeekResponse(headerMap, converterMap);
    }