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


Java MaterializedViewSubstitutionVisitor类代码示例

本文整理汇总了Java中org.apache.calcite.plan.MaterializedViewSubstitutionVisitor的典型用法代码示例。如果您正苦于以下问题:Java MaterializedViewSubstitutionVisitor类的具体用法?Java MaterializedViewSubstitutionVisitor怎么用?Java MaterializedViewSubstitutionVisitor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: substitute

import org.apache.calcite.plan.MaterializedViewSubstitutionVisitor; //导入依赖的package包/类
/**
 * Finds substitutions for the given query and target such that each satisfiable instance of
 * target is replaced with replacement.
 *
 * @param query  incoming query
 * @param target  target to replace
 * @param replacement  replacement that is computationally equivalent to target
 * @return  list of substitutions
 */
protected List<Substitution> substitute(
  final RelNode query, final RelNode target, final RelNode replacement) {
  return Lists.transform(new MaterializedViewSubstitutionVisitor(target, query).go(replacement), new Function<RelNode, Substitution>() {
    @Override
    public Substitution apply(RelNode input) {
      return new Substitution(input, null);
    }
  });
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:UnifyingSubstitutionProvider.java

示例2: apply

import org.apache.calcite.plan.MaterializedViewSubstitutionVisitor; //导入依赖的package包/类
protected void apply(RelOptRuleCall call, Filter filter, TableScan scan) {
  //Avoid optimizing already optimized scan
  if (scan instanceof QuarkViewScan || scan instanceof QuarkTileScan) {
    return;
  }
  RelNode root = filter.copy(filter.getTraitSet(),
      Collections.singletonList((RelNode) scan));
  RelOptPlanner planner = call.getPlanner();
  if (planner instanceof VolcanoPlanner) {
    List<RelOptMaterialization> materializations
        = ((VolcanoPlanner) planner).getMaterializations();
    for (RelOptMaterialization materialization : materializations) {
      if (scan.getRowType().equals(materialization.queryRel.getRowType())) {
        RelNode target = materialization.queryRel;
        final HepPlanner hepPlanner =
            new HepPlanner(program, planner.getContext());
        hepPlanner.setRoot(target);
        target = hepPlanner.findBestExp();
        List<RelNode> subs = new MaterializedViewSubstitutionVisitor(target, root)
            .go(materialization.tableRel);
        for (RelNode s : subs) {
          call.transformTo(s);
        }
      }
    }
  }
}
 
开发者ID:qubole,项目名称:quark,代码行数:28,代码来源:MaterializedViewFilterScanRule.java

示例3: apply

import org.apache.calcite.plan.MaterializedViewSubstitutionVisitor; //导入依赖的package包/类
protected void apply(RelOptRuleCall call, Filter filter, TableScan scan) {
  RelOptPlanner planner = call.getPlanner();
  List<RelOptMaterialization> materializations =
      (planner instanceof VolcanoPlanner)
          ? ((VolcanoPlanner) planner).getMaterializations()
          : ImmutableList.<RelOptMaterialization>of();
  if (!materializations.isEmpty()) {
    RelNode root = filter.copy(filter.getTraitSet(),
        Collections.singletonList((RelNode) scan));
    List<RelOptMaterialization> applicableMaterializations =
        RelOptMaterializations.getApplicableMaterializations(root, materializations);
    for (RelOptMaterialization materialization : applicableMaterializations) {
      if (RelOptUtil.areRowTypesEqual(scan.getRowType(),
          materialization.queryRel.getRowType(), false)) {
        RelNode target = materialization.queryRel;
        final HepPlanner hepPlanner =
            new HepPlanner(program, planner.getContext());
        hepPlanner.setRoot(target);
        target = hepPlanner.findBestExp();
        List<RelNode> subs = new MaterializedViewSubstitutionVisitor(target, root)
            .go(materialization.tableRel);
        for (RelNode s : subs) {
          call.transformTo(s);
        }
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:29,代码来源:MaterializedViewFilterScanRule.java


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