예제 #1
0
  private void validateFilterPushDown(GTInfo info) {
    if (!hasFilterPushDown()) return;

    Set<TblColRef> filterColumns = Sets.newHashSet();
    TupleFilter.collectColumns(filterPushDown, filterColumns);

    for (TblColRef col : filterColumns) {
      // filter columns must belong to the table
      info.validateColRef(col);
      // filter columns must be returned to satisfy upper layer evaluation (calcite)
      columns = columns.set(col.getColumnDesc().getZeroBasedIndex());
    }

    // un-evaluatable filter must be removed
    if (!TupleFilter.isEvaluableRecursively(filterPushDown)) {
      Set<TblColRef> unevaluableColumns = Sets.newHashSet();
      filterPushDown = GTUtil.convertFilterUnevaluatable(filterPushDown, info, unevaluableColumns);

      // columns in un-evaluatable filter must be returned without loss so upper layer can do final
      // evaluation
      if (hasAggregation()) {
        for (TblColRef col : unevaluableColumns) {
          aggrGroupBy = aggrGroupBy.set(col.getColumnDesc().getZeroBasedIndex());
        }
      }
    }
  }
예제 #2
0
 public List<Integer> getRequiredMeasures() {
   List<Integer> measures = Lists.newArrayList();
   int numDim = info.getPrimaryKey().trueBitCount();
   for (int i = 0; i < aggrMetrics.trueBitCount(); i++) {
     int index = aggrMetrics.trueBitAt(i);
     measures.add(index - numDim);
   }
   return measures;
 }
예제 #3
0
  private void validate(GTInfo info) {
    if (hasAggregation()) {
      if (aggrGroupBy.intersects(aggrMetrics)) throw new IllegalStateException();
      if (aggrMetrics.cardinality() != aggrMetricsFuncs.length) throw new IllegalStateException();

      if (columns == null) columns = ImmutableBitSet.EMPTY;

      columns = columns.or(aggrGroupBy);
      columns = columns.or(aggrMetrics);
    }

    if (columns == null) columns = info.colAll;

    this.selectedColBlocks = info.selectColumnBlocks(columns);

    if (hasFilterPushDown()) {
      validateFilterPushDown(info);
    }
  }
예제 #4
0
 // TODO BUG?  select sum() from fact, no aggr by
 public boolean hasAggregation() {
   return !aggrGroupBy.isEmpty() || !aggrMetrics.isEmpty();
 }