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


Java VolcanoPlanner类代码示例

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


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

示例1: setup

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的package包/类
@Before
public void setup() {
  optionManager = mock(OptionManager.class);
  when(optionManager.getOption(eq(ExecConstants.SLICE_TARGET)))
      .thenReturn(ExecConstants.SLICE_TARGET_OPTION.getDefault());
  when(optionManager.getOption(eq(PlannerSettings.ENABLE_LEAF_LIMITS.getOptionName())))
      .thenReturn(PlannerSettings.ENABLE_LEAF_LIMITS.getDefault());
  when(optionManager.getOption(eq(PlannerSettings.ENABLE_TRIVIAL_SINGULAR.getOptionName())))
      .thenReturn(PlannerSettings.ENABLE_TRIVIAL_SINGULAR.getDefault());

  plannerSettings = new PlannerSettings(optionManager, null, null);
  cluster = RelOptCluster.create(new VolcanoPlanner(plannerSettings), rexBuilder);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:TestSimpleLimitExchangeRemover.java

示例2: setup

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的package包/类
@Before
public void setup() {
  MockitoAnnotations.initMocks(this);

  final VolcanoPlanner planner = new VolcanoPlanner();
  typeFactory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
  RelOptCluster cluster = RelOptCluster.create(planner, new RexBuilder(typeFactory));
  builder = DremioRelFactories.LOGICAL_BUILDER.create(cluster, schema);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:TestLayoutExpander.java

示例3: apply

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的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

示例4: apply

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的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

示例5: CheapestPlanWithReflectionVisitor

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的package包/类
public CheapestPlanWithReflectionVisitor(VolcanoPlanner planner) {
  this.root = planner.getRoot();
  this.planner = planner;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:CheapestPlanWithReflectionVisitor.java

示例6: convertToRelRootAndJdbc

import org.apache.calcite.plan.volcano.VolcanoPlanner; //导入依赖的package包/类
private static RelNode convertToRelRootAndJdbc(SqlHandlerConfig config, SqlNode node) throws RelConversionException {

    // First try and convert without "expanding" exists/in/subqueries
    final RelRoot convertible = toConvertibleRelRoot(config, node, false);

    // convert scans
    // Check for RexSubQuery in the converted rel tree, and make sure that the table scans underlying
    // rel node with RexSubQuery have the same JDBC convention.
    final RelNode convertedNodeNotExpanded = convertScans(convertible.rel, config);
    RexSubQueryUtils.RexSubQueryPushdownChecker checker = new RexSubQueryUtils.RexSubQueryPushdownChecker(null);
    checker.visit(convertedNodeNotExpanded);

    final RelNode convertedNodeWithoutRexSubquery;
    final RelNode convertedNode;
    if (!checker.foundRexSubQuery()) {
      // If the not-expanded rel tree doesn't have any rex sub query, then everything is good.
      convertedNode = convertedNodeNotExpanded;
      convertedNodeWithoutRexSubquery = convertedNodeNotExpanded;
    } else {
      // If there is a rexSubQuery, then get the ones without (don't pass in SqlHandlerConfig here since we don't want to record it twice)
      convertedNodeWithoutRexSubquery = convertScans(toConvertibleRelRoot(config, node, true).rel, config);
      if (!checker.canPushdownRexSubQuery()) {
        // if there are RexSubQuery nodes with none-jdbc convention, abandon and expand the entire tree
        convertedNode = convertedNodeWithoutRexSubquery;
      } else {
        convertedNode = convertedNodeNotExpanded;
      }
    }

    // Set original root in volcano planner for acceleration (in this case, do not inject JdbcCrel or JdbcRel)
    final boolean leafLimitEnabled = config.getContext().getPlannerSettings().isLeafLimitsEnabled();
    final VolcanoPlanner volcanoPlanner = (VolcanoPlanner) convertedNodeNotExpanded.getCluster().getPlanner();
    final RelNode originalRoot = convertedNodeWithoutRexSubquery.accept(new InjectSampleAndJdbcLogical(leafLimitEnabled, false));
    volcanoPlanner.setOriginalRoot(originalRoot);

    // Now, transform jdbc nodes to Convention.NONE.  To do so, we need to inject a jdbc logical on top
    // of JDBC table scans with high cost and then plan to reduce the cost.
    final Stopwatch stopwatch = Stopwatch.createStarted();
    final RelNode injectJdbcLogical = convertedNode.accept(new InjectSampleAndJdbcLogical(leafLimitEnabled, true));
    final RelNode jdbcPushedPartial = transform(config, PlannerType.VOLCANO, PlannerPhase.JDBC_PUSHDOWN, injectJdbcLogical, injectJdbcLogical.getTraitSet(), false);

    // Transform all the subquery reltree into jdbc as well! If any of them fail, we abort and just use the expanded reltree.
    final RelsWithRexSubQueryTransformer transformer = new RelsWithRexSubQueryTransformer(config);
    final RelNode jdbcPushed = jdbcPushedPartial.accept(transformer);

    // Check that we do not have non-jdbc subqueries, if we do, then we have to abort and do a complete conversion.
    final FindNonJdbcConventionRexSubQuery noRexSubQueryChecker = new FindNonJdbcConventionRexSubQuery();
    final boolean found = transformer.failed() ? false : noRexSubQueryChecker.visit(jdbcPushed);

    final RelNode finalConvertedNode;
    if (transformer.failed() || found) {
      log("Failed to pushdown RexSubquery", jdbcPushed, logger, null);
      finalConvertedNode = convertedNodeWithoutRexSubquery.accept(new InjectSampleAndJdbcLogical(leafLimitEnabled, true)).accept(new ConvertJdbcLogicalToJdbcRel());
    } else {
      finalConvertedNode = jdbcPushed.accept(new ConvertJdbcLogicalToJdbcRel());
    }
    config.getObserver().planRelTransform(PlannerPhase.JDBC_PUSHDOWN, volcanoPlanner, convertedNode, finalConvertedNode, stopwatch.elapsed(TimeUnit.MILLISECONDS));

    return finalConvertedNode;
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:61,代码来源:PrelTransformer.java


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