Package org.eigenbase.relopt.hep

Examples of org.eigenbase.relopt.hep.HepProgramBuilder


  @Ignore // Optiq does not support INSERT yet
  @Test public void testReduceValuesNull() throws Exception {
    // The NULL literal presents pitfalls for value-reduction. Only
    // an INSERT statement contains un-CASTed NULL values.
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceValuesRule.PROJECT_INSTANCE)
        .build();
    checkPlanning(program,
        "insert into sales.depts(deptno,name) values (NULL, 'null')");
  }
View Full Code Here


    checkPlanning(program,
        "insert into sales.depts(deptno,name) values (NULL, 'null')");
  }

  @Test public void testReduceValuesToEmpty() throws Exception {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(PushFilterPastProjectRule.INSTANCE)
        .addRuleInstance(MergeProjectRule.INSTANCE)
        .addRuleInstance(ReduceValuesRule.PROJECT_FILTER_INSTANCE)
        .build();
View Full Code Here

        "select a + b as x, b, a from (values (10, 1), (30, 7)) as t(a, b)"
        + " where a - b < 0");
  }

  @Test public void testEmptyFilterProjectUnion() throws Exception {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(PushFilterPastSetOpRule.INSTANCE)
        .addRuleInstance(PushFilterPastProjectRule.INSTANCE)
        .addRuleInstance(MergeProjectRule.INSTANCE)
        .addRuleInstance(ReduceValuesRule.PROJECT_FILTER_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.PROJECT_INSTANCE)
View Full Code Here

        + ")\n"
        + "where x + y > 30");
  }

  @Test public void testEmptyJoin() {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.PROJECT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_LEFT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_RIGHT_INSTANCE)
        .build();
View Full Code Here

        + "select * from emp where false)\n"
        + "join dept using (deptno)");
  }

  @Test public void testEmptyJoinLeft() {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.PROJECT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_LEFT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_RIGHT_INSTANCE)
        .build();
View Full Code Here

        + "select * from emp where false)\n"
        + "left join dept using (deptno)");
  }

  @Test public void testEmptyJoinRight() {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.PROJECT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_LEFT_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.JOIN_RIGHT_INSTANCE)
        .build();
View Full Code Here

        + "select * from emp where false)\n"
        + "right join dept using (deptno)");
  }

  @Test public void testEmptySort() {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(RemoveEmptyRules.SORT_INSTANCE)
        .build();

    checkPlanning(program,
View Full Code Here

    checkPlanning(program,
        "select * from emp where false order by deptno");
  }

  @Test public void testEmptySortLimitZero() {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(RemoveEmptyRules.SORT_FETCH_ZERO_INSTANCE)
        .build();

    checkPlanning(program,
        "select * from emp order by deptno limit 0");
View Full Code Here

    checkPlanning(program,
        "select * from emp order by deptno limit 0");
  }

  @Test public void testReduceCasts() throws Exception {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(ReduceExpressionsRule.JOIN_INSTANCE)
        .build();

View Full Code Here

        + "on cast(d.deptno as integer) = cast(e.deptno as integer) "
        + "where cast(e.job as varchar(1)) = 'Manager'");
  }

  @Test public void testReduceCastAndConsts() throws Exception {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .build();

    // Make sure constant expressions inside the cast can be reduced
    // in addition to the casts.
View Full Code Here

TOP

Related Classes of org.eigenbase.relopt.hep.HepProgramBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.