當前位置: 首頁>>代碼示例>>Java>>正文


Java RelOptPredicateList.union方法代碼示例

本文整理匯總了Java中org.apache.calcite.plan.RelOptPredicateList.union方法的典型用法代碼示例。如果您正苦於以下問題:Java RelOptPredicateList.union方法的具體用法?Java RelOptPredicateList.union怎麽用?Java RelOptPredicateList.union使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.calcite.plan.RelOptPredicateList的用法示例。


在下文中一共展示了RelOptPredicateList.union方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPredicates

import org.apache.calcite.plan.RelOptPredicateList; //導入方法依賴的package包/類
/** @see RelMetadataQuery#getPulledUpPredicates(RelNode) */
public RelOptPredicateList getPredicates(RelSubset r,
    RelMetadataQuery mq) {
  if (!Bug.CALCITE_1048_FIXED) {
    return RelOptPredicateList.EMPTY;
  }
  final RexBuilder rexBuilder = r.getCluster().getRexBuilder();
  RelOptPredicateList list = null;
  for (RelNode r2 : r.getRels()) {
    RelOptPredicateList list2 = mq.getPulledUpPredicates(r2);
    if (list2 != null) {
      list = list == null ? list2 : list.union(rexBuilder, list2);
    }
  }
  return Util.first(list, RelOptPredicateList.EMPTY);
}
 
開發者ID:apache,項目名稱:calcite,代碼行數:17,代碼來源:RelMdPredicates.java

示例2: getAllPredicates

import org.apache.calcite.plan.RelOptPredicateList; //導入方法依賴的package包/類
/**
 * Add the Filter condition to the list obtained from the input.
 */
public RelOptPredicateList getAllPredicates(Filter filter, RelMetadataQuery mq) {
  final RelNode input = filter.getInput();
  final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
  final RexNode pred = filter.getCondition();

  final RelOptPredicateList predsBelow = mq.getAllPredicates(input);
  if (predsBelow == null) {
    // Safety check
    return null;
  }

  // Extract input fields referenced by Filter condition
  final Set<RelDataTypeField> inputExtraFields = new LinkedHashSet<>();
  final RelOptUtil.InputFinder inputFinder = new RelOptUtil.InputFinder(inputExtraFields);
  pred.accept(inputFinder);
  final ImmutableBitSet inputFieldsUsed = inputFinder.inputBitSet.build();

  // Infer column origin expressions for given references
  final Map<RexInputRef, Set<RexNode>> mapping = new LinkedHashMap<>();
  for (int idx : inputFieldsUsed) {
    final RexInputRef ref = RexInputRef.of(idx, filter.getRowType().getFieldList());
    final Set<RexNode> originalExprs = mq.getExpressionLineage(filter, ref);
    if (originalExprs == null) {
      // Bail out
      return null;
    }
    mapping.put(ref, originalExprs);
  }

  // Replace with new expressions and return union of predicates
  return predsBelow.union(rexBuilder,
      RelOptPredicateList.of(rexBuilder,
          RelMdExpressionLineage.createAllPossibleExpressions(rexBuilder, pred, mapping)));
}
 
開發者ID:apache,項目名稱:calcite,代碼行數:38,代碼來源:RelMdAllPredicates.java

示例3: onMatch

import org.apache.calcite.plan.RelOptPredicateList; //導入方法依賴的package包/類
@Override public void onMatch(RelOptRuleCall call) {
  final Join join = call.rel(0);
  final List<RexNode> expList = Lists.newArrayList(join.getCondition());
  final int fieldCount = join.getLeft().getRowType().getFieldCount();
  final RelMetadataQuery mq = call.getMetadataQuery();
  final RelOptPredicateList leftPredicates =
      mq.getPulledUpPredicates(join.getLeft());
  final RelOptPredicateList rightPredicates =
      mq.getPulledUpPredicates(join.getRight());
  final RexBuilder rexBuilder = join.getCluster().getRexBuilder();
  final RelOptPredicateList predicates =
      leftPredicates.union(rexBuilder,
          rightPredicates.shift(rexBuilder, fieldCount));
  if (!reduceExpressions(join, expList, predicates, true,
      matchNullability)) {
    return;
  }
  if (join instanceof EquiJoin) {
    final JoinInfo joinInfo =
        JoinInfo.of(join.getLeft(), join.getRight(), expList.get(0));
    if (!joinInfo.isEqui()) {
      // This kind of join must be an equi-join, and the condition is
      // no longer an equi-join. SemiJoin is an example of this.
      return;
    }
  }
  call.transformTo(
      join.copy(
          join.getTraitSet(),
          expList.get(0),
          join.getLeft(),
          join.getRight(),
          join.getJoinType(),
          join.isSemiJoinDone()));

  // New plan is absolutely better than old plan.
  call.getPlanner().setImportance(join, 0.0);
}
 
開發者ID:apache,項目名稱:calcite,代碼行數:39,代碼來源:ReduceExpressionsRule.java


注:本文中的org.apache.calcite.plan.RelOptPredicateList.union方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。