本文整理汇总了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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}