当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableBitSet.nextSetBit方法代码示例

本文整理汇总了Java中org.apache.calcite.util.ImmutableBitSet.nextSetBit方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableBitSet.nextSetBit方法的具体用法?Java ImmutableBitSet.nextSetBit怎么用?Java ImmutableBitSet.nextSetBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.util.ImmutableBitSet的用法示例。


在下文中一共展示了ImmutableBitSet.nextSetBit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExprsItr

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
ExprsItr(ImmutableBitSet fields) {
  nextMapping = null;
  columns = new int[fields.cardinality()];
  columnSets = new BitSet[fields.cardinality()];
  iterationIdx = new int[fields.cardinality()];
  for (int j = 0, i = fields.nextSetBit(0); i >= 0; i = fields
      .nextSetBit(i + 1), j++) {
    columns[j] = i;
    columnSets[j] = equivalence.get(i);
    iterationIdx[j] = 0;
  }
  firstCall = true;
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:RelMdPredicates.java

示例2: setFactorJoinKeys

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/**
 * Locates from a list of filters those that correspond to a particular join
 * tree. Then, for each of those filters, extracts the fields corresponding
 * to a particular factor, setting them in a bitmap.
 *
 * @param multiJoin join factors being optimized
 * @param filters list of join filters
 * @param joinFactors bitmap containing the factors in a particular join
 * tree
 * @param factorStart the initial offset of the factor whose join keys will
 * be extracted
 * @param nFields the number of fields in the factor whose join keys will be
 * extracted
 * @param joinKeys the bitmap that will be set with the join keys
 */
private void setFactorJoinKeys(
    LoptMultiJoin multiJoin,
    List<RexNode> filters,
    ImmutableBitSet joinFactors,
    int factorStart,
    int nFields,
    ImmutableBitSet.Builder joinKeys) {
  for (RexNode joinFilter : filters) {
    ImmutableBitSet filterFactors =
        multiJoin.getFactorsRefByJoinFilter(joinFilter);

    // if all factors in the join filter are in the bitmap containing
    // the factors in a join tree, then from that filter, add the
    // fields corresponding to the specified factor to the join key
    // bitmap; in doing so, adjust the join keys so they start at
    // offset 0
    if (joinFactors.contains(filterFactors)) {
      ImmutableBitSet joinFields =
          multiJoin.getFieldsRefByJoinFilter(joinFilter);
      for (int field = joinFields.nextSetBit(factorStart);
           (field >= 0)
               && (field < (factorStart + nFields));
           field = joinFields.nextSetBit(field + 1)) {
        joinKeys.set(field - factorStart);
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:44,代码来源:LoptOptimizeJoinRule.java

示例3: of

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
static Side of(ImmutableBitSet bitSet, int middle) {
  final int firstBit = bitSet.nextSetBit(0);
  if (firstBit < 0) {
    return EMPTY;
  }
  if (firstBit >= middle) {
    return RIGHT;
  }
  if (bitSet.nextSetBit(middle) < 0) {
    return LEFT;
  }
  return BOTH;
}
 
开发者ID:apache,项目名称:calcite,代码行数:14,代码来源:RelOptUtil.java

示例4: setFactorWeights

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/**
 * Sets weighting for each combination of factors, depending on which join
 * filters reference which factors. Greater weight is given to equality
 * conditions. Also, sets bitmaps indicating which factors are referenced by
 * each factor within join filters that are comparisons.
 */
public void setFactorWeights() {
  factorWeights = new int[nJoinFactors][nJoinFactors];
  factorsRefByFactor = new ImmutableBitSet[nJoinFactors];
  for (int i = 0; i < nJoinFactors; i++) {
    factorsRefByFactor[i] = ImmutableBitSet.of();
  }

  for (RexNode joinFilter : allJoinFilters) {
    ImmutableBitSet factorRefs = factorsRefByJoinFilter.get(joinFilter);

    // don't give weights to non-comparison expressions
    if (!(joinFilter instanceof RexCall)) {
      continue;
    }
    if (!joinFilter.isA(SqlKind.COMPARISON)) {
      continue;
    }

    // OR the factors referenced in this join filter into the
    // bitmaps corresponding to each of the factors; however,
    // exclude the bit corresponding to the factor itself
    for (int factor : factorRefs) {
      factorsRefByFactor[factor] =
          factorsRefByFactor[factor]
              .rebuild()
              .addAll(factorRefs)
              .clear(factor)
              .build();
    }

    if (factorRefs.cardinality() == 2) {
      int leftFactor = factorRefs.nextSetBit(0);
      int rightFactor = factorRefs.nextSetBit(leftFactor + 1);

      final RexCall call = (RexCall) joinFilter;
      ImmutableBitSet leftFields = fieldBitmap(call.getOperands().get(0));
      ImmutableBitSet leftBitmap = factorBitmap(leftFields);

      // filter contains only two factor references, one on each
      // side of the operator
      int weight;
      if (leftBitmap.cardinality() == 1) {
        // give higher weight to equi-joins
        switch (joinFilter.getKind()) {
        case EQUALS:
          weight = 3;
          break;
        default:
          weight = 2;
        }
      } else {
        // cross product of two tables
        weight = 1;
      }
      setFactorWeight(weight, leftFactor, rightFactor);
    } else {
      // multiple factor references -- set a weight for each
      // combination of factors referenced within the filter
      final List<Integer> list  = ImmutableIntList.copyOf(factorRefs);
      for (int outer : list) {
        for (int inner : list) {
          if (outer != inner) {
            setFactorWeight(1, outer, inner);
          }
        }
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:76,代码来源:LoptMultiJoin.java


注:本文中的org.apache.calcite.util.ImmutableBitSet.nextSetBit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。