• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FilterJoinRule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: decorrelate

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
private RelNode decorrelate(RelNode root) {
	// first adjust count() expression if any
	HepProgram program = HepProgram.builder().addRuleInstance(new AdjustProjectForCountAggregateRule(false)).addRuleInstance(new AdjustProjectForCountAggregateRule(true)).addRuleInstance(FilterJoinRule.FILTER_ON_JOIN).addRuleInstance(FilterProjectTransposeRule.INSTANCE).addRuleInstance(FilterCorrelateRule.INSTANCE).build();

	HepPlanner planner = createPlanner(program);

	planner.setRoot(root);
	root = planner.findBestExp();

	// Perform decorrelation.
	map.clear();

	final Frame frame = getInvoke(root, null);
	if (frame != null) {
		// has been rewritten; apply rules post-decorrelation
		final HepProgram program2 = HepProgram.builder().addRuleInstance(FilterJoinRule.FILTER_ON_JOIN).addRuleInstance(FilterJoinRule.JOIN).build();

		final HepPlanner planner2 = createPlanner(program2);
		final RelNode newRoot = frame.r;
		planner2.setRoot(newRoot);
		return planner2.findBestExp();
	}

	return root;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:FlinkRelDecorrelator.java


示例2: registerAbstractRelationalRules

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
public void registerAbstractRelationalRules() {
  addRule(FilterJoinRule.FILTER_ON_JOIN);
  addRule(FilterJoinRule.JOIN);
  addRule(AbstractConverter.ExpandConversionRule.INSTANCE);
  addRule(JoinCommuteRule.INSTANCE);
  addRule(SemiJoinRule.PROJECT);
  addRule(SemiJoinRule.JOIN);
  if (CalcitePrepareImpl.COMMUTE) {
    addRule(JoinAssociateRule.INSTANCE);
  }
  addRule(AggregateRemoveRule.INSTANCE);
  addRule(UnionToDistinctRule.INSTANCE);
  addRule(ProjectRemoveRule.INSTANCE);
  addRule(AggregateJoinTransposeRule.INSTANCE);
  addRule(AggregateProjectMergeRule.INSTANCE);
  addRule(CalcRemoveRule.INSTANCE);
  addRule(SortRemoveRule.INSTANCE);

  // todo: rule which makes Project({OrdinalRef}) disappear
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:VolcanoPlanner.java


示例3: toLeafJoinForm

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/**
 * Converts a relational expression to a form where
 * {@link org.apache.calcite.rel.logical.LogicalJoin}s are
 * as close to leaves as possible.
 */
public static RelNode toLeafJoinForm(RelNode rel) {
  final Program program = Programs.hep(
      ImmutableList.of(
          JoinProjectTransposeRule.RIGHT_PROJECT,
          JoinProjectTransposeRule.LEFT_PROJECT,
          FilterJoinRule.FilterIntoJoinRule.FILTER_ON_JOIN,
          ProjectRemoveRule.INSTANCE,
          ProjectMergeRule.INSTANCE),
      false,
      DefaultRelMetadataProvider.INSTANCE);
  if (CalcitePrepareImpl.DEBUG) {
    System.out.println(
        RelOptUtil.dumpPlan("before", rel, SqlExplainFormat.TEXT,
            SqlExplainLevel.DIGEST_ATTRIBUTES));
  }
  final RelNode rel2 = program.run(null, rel, null,
      ImmutableList.<RelOptMaterialization>of(),
      ImmutableList.<RelOptLattice>of());
  if (CalcitePrepareImpl.DEBUG) {
    System.out.println(
        RelOptUtil.dumpPlan("after", rel2, SqlExplainFormat.TEXT,
            SqlExplainLevel.DIGEST_ATTRIBUTES));
  }
  return rel2;
}
 
开发者ID:apache,项目名称:calcite,代码行数:31,代码来源:RelOptMaterialization.java


示例4: testStrengthenJoinType

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testStrengthenJoinType() {
  // The "Filter(... , right.c IS NOT NULL)" above a left join is pushed into
  // the join, makes it an inner join, and then disappears because c is NOT
  // NULL.
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .build();
  final String sql = "select *\n"
      + "from dept left join emp using (deptno)\n"
      + "where emp.deptno is not null and emp.sal > 100";
  sql(sql)
      .withDecorrelation(true)
      .withTrim(true)
      .withPre(preProgram)
      .with(program)
      .check();
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:RelOptRulesTest.java


示例5: testSemiJoinRuleExists

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testSemiJoinRuleExists() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();
  final String sql = "select * from dept where exists (\n"
      + "  select * from emp\n"
      + "  where emp.deptno = dept.deptno\n"
      + "  and emp.sal > 100)";
  sql(sql)
      .withDecorrelation(true)
      .withTrim(true)
      .withPre(preProgram)
      .with(program)
      .check();
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:RelOptRulesTest.java


示例6: testSemiJoinRule

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testSemiJoinRule() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();
  final String sql = "select dept.* from dept join (\n"
      + "  select distinct deptno from emp\n"
      + "  where sal > 100) using (deptno)";
  sql(sql)
      .withDecorrelation(true)
      .withTrim(true)
      .withPre(preProgram)
      .with(program)
      .check();
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:RelOptRulesTest.java


示例7: testSemiJoinRuleRight

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/** Test case for
 * <a href="https://issues.apache.org/jira/browse/CALCITE-1495">[CALCITE-1495]
 * SemiJoinRule should not apply to RIGHT and FULL JOIN</a>. */
@Test public void testSemiJoinRuleRight() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();
  final String sql = "select dept.* from dept right join (\n"
      + "  select distinct deptno from emp\n"
      + "  where sal > 100) using (deptno)";
  sql(sql)
      .withPre(preProgram)
      .with(program)
      .withDecorrelation(true)
      .withTrim(true)
      .checkUnchanged();
}
 
开发者ID:apache,项目名称:calcite,代码行数:25,代码来源:RelOptRulesTest.java


示例8: testSemiJoinRuleFull

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/** Similar to {@link #testSemiJoinRuleRight()} but FULL. */
@Test public void testSemiJoinRuleFull() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();
  final String sql = "select dept.* from dept full join (\n"
      + "  select distinct deptno from emp\n"
      + "  where sal > 100) using (deptno)";
  sql(sql)
      .withPre(preProgram)
      .with(program)
      .withDecorrelation(true)
      .withTrim(true)
      .checkUnchanged();
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:RelOptRulesTest.java


示例9: testSemiJoinRuleLeft

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/** Similar to {@link #testSemiJoinRule()} but LEFT. */
@Test public void testSemiJoinRuleLeft() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(ProjectMergeRule.INSTANCE)
          .build();
  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();
  final String sql = "select name from dept left join (\n"
      + "  select distinct deptno from emp\n"
      + "  where sal > 100) using (deptno)";
  sql(sql)
      .withPre(preProgram)
      .with(program)
      .withDecorrelation(true)
      .withTrim(true)
      .check();
}
 
开发者ID:apache,项目名称:calcite,代码行数:23,代码来源:RelOptRulesTest.java


示例10: testPushFilterThroughSemiJoin

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/** Test case for
 * <a href="https://issues.apache.org/jira/browse/CALCITE-438">[CALCITE-438]
 * Push predicates through SemiJoin</a>. */
@Test public void testPushFilterThroughSemiJoin() {
  final HepProgram preProgram =
      HepProgram.builder()
          .addRuleInstance(SemiJoinRule.PROJECT)
          .build();

  final HepProgram program =
      HepProgram.builder()
          .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
          .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
          .addRuleInstance(FilterJoinRule.JOIN)
          .build();
  final String sql = "select * from (\n"
      + "  select * from dept where dept.deptno in (\n"
      + "    select emp.deptno from emp))R\n"
      + "where R.deptno <=10";
  sql(sql)
      .withDecorrelation(true)
      .withTrim(false)
      .withPre(preProgram)
      .with(program)
      .check();
}
 
开发者ID:apache,项目名称:calcite,代码行数:27,代码来源:RelOptRulesTest.java


示例11: testMergeJoinFilter

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
/** Tests that a filters is combined are combined if they are identical,
 * even if one of them originates in an ON clause of a JOIN. */
@Test public void testMergeJoinFilter() throws Exception {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
      .addRuleInstance(FilterMergeRule.INSTANCE)
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .build();

  checkPlanning(program,
      "select * from (\n"
          + "  select d.deptno, e.ename\n"
          + "  from emp as e\n"
          + "  join dept as d\n"
          + "  on e.deptno = d.deptno\n"
          + "  and d.deptno = 10)\n"
          + "where deptno = 10\n");
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:RelOptRulesTest.java


示例12: getVolcanoPlanner

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
private RelOptPlanner getVolcanoPlanner(RelNode root) {
  final RelBuilderFactory builderFactory =
      RelBuilder.proto(PigRelFactories.ALL_PIG_REL_FACTORIES);
  final RelOptPlanner planner = root.getCluster().getPlanner(); // VolcanoPlanner
  for (RelOptRule r : PigRules.ALL_PIG_OPT_RULES) {
    planner.addRule(r);
  }
  planner.removeRule(FilterAggregateTransposeRule.INSTANCE);
  planner.removeRule(FilterJoinRule.FILTER_ON_JOIN);
  planner.addRule(
      new FilterAggregateTransposeRule(PigFilter.class, builderFactory, PigAggregate.class));
  planner.addRule(new FilterIntoJoinRule(true, builderFactory, TRUE_PREDICATE));
  planner.setRoot(root);
  return planner;
}
 
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:PigRelBuilderStyleTest.java


示例13: decorrelate

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
private RelNode decorrelate(RelNode root) {
  // first adjust count() expression if any
  HepProgram program = HepProgram.builder()
      .addRuleInstance(new AdjustProjectForCountAggregateRule(false))
      .addRuleInstance(new AdjustProjectForCountAggregateRule(true))
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addRuleInstance(FilterProjectTransposeRule.INSTANCE)
      .addRuleInstance(FilterCorrelateRule.INSTANCE)
      .build();

  HepPlanner planner = createPlanner(program);

  planner.setRoot(root);
  root = planner.findBestExp();

  // Perform decorrelation.
  map.clear();

  final Frame frame = getInvoke(root, null);
  if (frame != null) {
    // has been rewritten; apply rules post-decorrelation
    final HepProgram program2 = HepProgram.builder()
        .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
        .addRuleInstance(FilterJoinRule.JOIN)
        .build();

    final HepPlanner planner2 = createPlanner(program2);
    final RelNode newRoot = frame.r;
    planner2.setRoot(newRoot);
    return planner2.findBestExp();
  }

  return root;
}
 
开发者ID:apache,项目名称:calcite,代码行数:35,代码来源:RelDecorrelator.java


示例14: testConvertSemiJoin

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testConvertSemiJoin() {
  final String sql = "select * from dept where exists (\n"
      + "  select * from emp\n"
      + "  where emp.deptno = dept.deptno\n"
      + "  and emp.sal > 100)";
  checkConvertMutableRel(
      "SemiJoin",
      sql,
      true,
      ImmutableList.of(
          FilterProjectTransposeRule.INSTANCE,
          FilterJoinRule.FILTER_ON_JOIN,
          ProjectMergeRule.INSTANCE,
          SemiJoinRule.PROJECT));
}
 
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:MutableRelTest.java


示例15: testPushSemiJoinPastJoinRuleLeft

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testPushSemiJoinPastJoinRuleLeft() throws Exception {
  // tests the case where the semijoin is pushed to the left
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addRuleInstance(JoinAddRedundantSemiJoinRule.INSTANCE)
      .addRuleInstance(SemiJoinJoinTransposeRule.INSTANCE)
      .build();
  checkPlanning(program,
      "select e1.ename from emp e1, dept d, emp e2 "
          + "where e1.deptno = d.deptno and e1.empno = e2.empno");
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:RelOptRulesTest.java


示例16: testPushSemiJoinPastJoinRuleRight

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testPushSemiJoinPastJoinRuleRight() throws Exception {
  // tests the case where the semijoin is pushed to the right
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addRuleInstance(JoinAddRedundantSemiJoinRule.INSTANCE)
      .addRuleInstance(SemiJoinJoinTransposeRule.INSTANCE)
      .build();
  checkPlanning(program,
      "select e1.ename from emp e1, dept d, emp e2 "
          + "where e1.deptno = d.deptno and d.deptno = e2.deptno");
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:RelOptRulesTest.java


示例17: testPushSemiJoinPastFilter

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testPushSemiJoinPastFilter() throws Exception {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addRuleInstance(JoinAddRedundantSemiJoinRule.INSTANCE)
      .addRuleInstance(SemiJoinFilterTransposeRule.INSTANCE)
      .build();
  checkPlanning(program,
      "select e.ename from emp e, dept d "
          + "where e.deptno = d.deptno and e.ename = 'foo'");
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelOptRulesTest.java


示例18: testConvertMultiJoinRule

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testConvertMultiJoinRule() throws Exception {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addMatchOrder(HepMatchOrder.BOTTOM_UP)
      .addRuleInstance(JoinToMultiJoinRule.INSTANCE)
      .build();
  checkPlanning(program,
      "select e1.ename from emp e1, dept d, emp e2 "
          + "where e1.deptno = d.deptno and d.deptno = e2.deptno");
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelOptRulesTest.java


示例19: testSkipReduceConstantsCaseEquals

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test
public void testSkipReduceConstantsCaseEquals() throws Exception {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
      .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
      .addRuleInstance(FilterJoinRule.FilterIntoJoinRule.FILTER_ON_JOIN)
      .build();

  checkPlanning(program,
      "select * from emp e1, emp e2\n"
          + "where coalesce(e1.mgr, -1) = coalesce(e2.mgr, -1)");
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:RelOptRulesTest.java


示例20: testRemoveSemiJoin

import org.apache.calcite.rel.rules.FilterJoinRule; //导入依赖的package包/类
@Test public void testRemoveSemiJoin() throws Exception {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN)
      .addRuleInstance(JoinAddRedundantSemiJoinRule.INSTANCE)
      .addRuleInstance(SemiJoinRemoveRule.INSTANCE)
      .build();
  checkPlanning(program,
      "select e.ename from emp e, dept d "
          + "where e.deptno = d.deptno");
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:RelOptRulesTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DbKit类代码示例发布时间:2022-05-22
下一篇:
Java ClientDriverRule类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap