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


Java Filter.copy方法代码示例

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


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

示例1: apply

import org.apache.calcite.rel.core.Filter; //导入方法依赖的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

示例2: apply

import org.apache.calcite.rel.core.Filter; //导入方法依赖的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

示例3: onMatch

import org.apache.calcite.rel.core.Filter; //导入方法依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final Filter filter = call.rel(0);
  final Project project = call.rel(1);

  if (RexOver.containsOver(project.getProjects(), null)) {
    // In general a filter cannot be pushed below a windowing calculation.
    // Applying the filter before the aggregation function changes
    // the results of the windowing invocation.
    //
    // When the filter is on the PARTITION BY expression of the OVER clause
    // it can be pushed down. For now we don't support this.
    return;
  }

  if (RexUtil.containsCorrelation(filter.getCondition())) {
    // If there is a correlation condition anywhere in the filter, don't
    // push this filter past project since in some cases it can prevent a
    // Correlate from being de-correlated.
    return;
  }

  // convert the filter to one that references the child of the project
  RexNode newCondition =
      RelOptUtil.pushPastProject(filter.getCondition(), project);

  final RelBuilder relBuilder = call.builder();
  RelNode newFilterRel;
  if (copyFilter) {
    newFilterRel = filter.copy(filter.getTraitSet(), project.getInput(),
        RexUtil.removeNullabilityCast(relBuilder.getTypeFactory(),
            newCondition));
  } else {
    newFilterRel =
        relBuilder.push(project.getInput()).filter(newCondition).build();
  }

  RelNode newProjRel =
      copyProject
          ? project.copy(project.getTraitSet(), newFilterRel,
              project.getProjects(), project.getRowType())
          : relBuilder.push(newFilterRel)
              .project(project.getProjects(), project.getRowType().getFieldNames())
              .build();

  call.transformTo(newProjRel);
}
 
开发者ID:apache,项目名称:calcite,代码行数:47,代码来源:FilterProjectTransposeRule.java


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