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


Java ImmutableBitSet.intersects方法代码示例

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


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

示例1: split

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/**
 * Splits a condition into conjunctions that do or do not intersect with
 * a given bit set.
 */
static void split(RexNode condition, ImmutableBitSet bitSet, List<RexNode> intersecting, List<RexNode> nonIntersecting) {
    for (RexNode node : RelOptUtil.conjunctions(condition)) {
        ImmutableBitSet inputBitSet = RelOptUtil.InputFinder.bits(node);
        if (bitSet.intersects(inputBitSet)) {
            intersecting.add(node);
        } else {
            nonIntersecting.add(node);
        }
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:OLAPJoinPushThroughJoinRule.java

示例2: split

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/**
 * Splits a condition into conjunctions that do or do not intersect with
 * a given bit set.
 */
static void split(
    RexNode condition,
    ImmutableBitSet bitSet,
    List<RexNode> intersecting,
    List<RexNode> nonIntersecting) {
  for (RexNode node : RelOptUtil.conjunctions(condition)) {
    ImmutableBitSet inputBitSet = RelOptUtil.InputFinder.bits(node);
    if (bitSet.intersects(inputBitSet)) {
      intersecting.add(node);
    } else {
      nonIntersecting.add(node);
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:JoinPushThroughJoinRule.java

示例3: projectPredicate

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/** Converts a predicate on a particular set of columns into a predicate on
 * a subset of those columns, weakening if necessary.
 *
 * <p>If not possible to simplify, returns {@code true}, which is the weakest
 * possible predicate.
 *
 * <p>Examples:<ol>
 * <li>The predicate {@code $7 = $9} on columns [7]
 *     becomes {@code $7 is not null}
 * <li>The predicate {@code $7 = $9 + $11} on columns [7, 9]
 *     becomes {@code $7 is not null or $9 is not null}
 * <li>The predicate {@code $7 = $9 and $9 = 5} on columns [7] becomes
 *   {@code $7 = 5}
 * <li>The predicate
 *   {@code $7 = $9 and ($9 = $1 or $9 = $2) and $1 > 3 and $2 > 10}
 *   on columns [7] becomes {@code $7 > 3}
 * </ol>
 *
 * <p>We currently only handle examples 1 and 2.
 *
 * @param rexBuilder Rex builder
 * @param input Input relational expression
 * @param r Predicate expression
 * @param columnsMapped Columns which the final predicate can reference
 * @return Predicate expression narrowed to reference only certain columns
 */
private RexNode projectPredicate(final RexBuilder rexBuilder, RelNode input,
    RexNode r, ImmutableBitSet columnsMapped) {
  ImmutableBitSet rCols = RelOptUtil.InputFinder.bits(r);
  if (columnsMapped.contains(rCols)) {
    // All required columns are present. No need to weaken.
    return r;
  }
  if (columnsMapped.intersects(rCols)) {
    final List<RexNode> list = new ArrayList<>();
    for (int c : columnsMapped.intersect(rCols)) {
      if (input.getRowType().getFieldList().get(c).getType().isNullable()
          && Strong.isNull(r, ImmutableBitSet.of(c))) {
        list.add(
            rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_NULL,
                rexBuilder.makeInputRef(input, c)));
      }
    }
    if (!list.isEmpty()) {
      return RexUtil.composeDisjunction(rexBuilder, list);
    }
  }
  // Cannot weaken to anything non-trivial
  return rexBuilder.makeLiteral(true);
}
 
开发者ID:apache,项目名称:calcite,代码行数:51,代码来源:RelMdPredicates.java

示例4: perform

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
protected void perform(RelOptRuleCall call, Project project,
    Join join, RelNode left, Aggregate aggregate) {
  final RelOptCluster cluster = join.getCluster();
  final RexBuilder rexBuilder = cluster.getRexBuilder();
  if (project != null) {
    final ImmutableBitSet bits =
        RelOptUtil.InputFinder.bits(project.getProjects(), null);
    final ImmutableBitSet rightBits =
        ImmutableBitSet.range(left.getRowType().getFieldCount(),
            join.getRowType().getFieldCount());
    if (bits.intersects(rightBits)) {
      return;
    }
  }
  final JoinInfo joinInfo = join.analyzeCondition();
  if (!joinInfo.rightSet().equals(
      ImmutableBitSet.range(aggregate.getGroupCount()))) {
    // Rule requires that aggregate key to be the same as the join key.
    // By the way, neither a super-set nor a sub-set would work.
    return;
  }
  if (!joinInfo.isEqui()) {
    return;
  }
  final RelBuilder relBuilder = call.builder();
  relBuilder.push(left);
  switch (join.getJoinType()) {
  case INNER:
    final List<Integer> newRightKeyBuilder = Lists.newArrayList();
    final List<Integer> aggregateKeys = aggregate.getGroupSet().asList();
    for (int key : joinInfo.rightKeys) {
      newRightKeyBuilder.add(aggregateKeys.get(key));
    }
    final ImmutableIntList newRightKeys = ImmutableIntList.copyOf(newRightKeyBuilder);
    relBuilder.push(aggregate.getInput());
    final RexNode newCondition =
        RelOptUtil.createEquiJoinCondition(relBuilder.peek(2, 0),
            joinInfo.leftKeys, relBuilder.peek(2, 1), newRightKeys,
            rexBuilder);
    relBuilder.semiJoin(newCondition);
    break;

  case LEFT:
    // The right-hand side produces no more than 1 row (because of the
    // Aggregate) and no fewer than 1 row (because of LEFT), and therefore
    // we can eliminate the semi-join.
    break;

  default:
    throw new AssertionError(join.getJoinType());
  }
  if (project != null) {
    relBuilder.project(project.getProjects(), project.getRowType().getFieldNames());
  }
  call.transformTo(relBuilder.build());
}
 
开发者ID:apache,项目名称:calcite,代码行数:57,代码来源:SemiJoinRule.java


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