public class RelOptFixture extends Object
It provides a fluent API so that you can write tests by chaining method calls.
A fixture is immutable. If you have two test cases that require a similar set up (for example, the same SQL expression and set of planner rules), it is safe to use the same fixture object as a starting point for both tests.
| 限定符和类型 | 方法和说明 |
|---|---|
void |
check()
Checks the plan for a SQL statement before/after executing a given rule,
with an optional pre-program specified by
withPre(HepProgram)
to prepare the tree. |
void |
checkUnchanged()
Checks that the plan is the same before and after executing a given
planner.
|
DiffRepository |
diffRepos()
Returns the diff repository, checking that it is not null.
|
RelOptFixture |
sql(String sql) |
org.apache.calcite.rel.RelNode |
toRel() |
RelOptFixture |
withAfter(BiFunction<RelOptFixture,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> transform) |
RelOptFixture |
withBefore(BiFunction<RelOptFixture,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> transform) |
RelOptFixture |
withCatalogReaderFactory(SqlTestFactory.CatalogReaderFactory factory) |
RelOptFixture |
withConfig(UnaryOperator<org.apache.calcite.sql2rel.SqlToRelConverter.Config> transform) |
RelOptFixture |
withConformance(org.apache.calcite.sql.validate.SqlConformance conformance) |
RelOptFixture |
withContext(UnaryOperator<org.apache.calcite.plan.Context> transform) |
RelOptFixture |
withDecorrelate(boolean decorrelate) |
RelOptFixture |
withDiffRepos(DiffRepository diffRepos) |
RelOptFixture |
withDynamicTable() |
RelOptFixture |
withExpand(boolean expand) |
RelOptFixture |
withFactory(UnaryOperator<SqlTestFactory> transform) |
<T> RelOptFixture |
withHook(org.apache.calcite.runtime.Hook hook,
Consumer<T> handler)
Adds a hook and a handler for that hook.
|
RelOptFixture |
withLateDecorrelate(boolean lateDecorrelate) |
RelOptFixture |
withPlanner(org.apache.calcite.plan.RelOptPlanner planner) |
RelOptFixture |
withPre(org.apache.calcite.plan.hep.HepProgram preProgram) |
RelOptFixture |
withPreRule(org.apache.calcite.plan.RelOptRule... rules) |
RelOptFixture |
withProgram(org.apache.calcite.plan.hep.HepProgram program) |
<V> RelOptFixture |
withProperty(org.apache.calcite.runtime.Hook hook,
V value) |
RelOptFixture |
withRelBuilderConfig(UnaryOperator<org.apache.calcite.tools.RelBuilder.Config> transform) |
RelOptFixture |
withRelBuilderSimplify(boolean simplify) |
RelOptFixture |
withRelSupplier(org.apache.calcite.test.RelSupplier relSupplier) |
RelOptFixture |
withRule(org.apache.calcite.plan.RelOptRule... rules) |
RelOptFixture |
withSubQueryRules() |
RelOptFixture |
withTrim(boolean trim) |
RelOptFixture |
withVolcanoPlanner(boolean topDown) |
RelOptFixture |
withVolcanoPlanner(boolean topDown,
Consumer<org.apache.calcite.plan.volcano.VolcanoPlanner> init) |
public RelOptFixture withDiffRepos(DiffRepository diffRepos)
public RelOptFixture withRelSupplier(org.apache.calcite.test.RelSupplier relSupplier)
public RelOptFixture sql(String sql)
public RelOptFixture withBefore(BiFunction<RelOptFixture,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> transform)
public RelOptFixture withAfter(BiFunction<RelOptFixture,org.apache.calcite.rel.RelNode,org.apache.calcite.rel.RelNode> transform)
public RelOptFixture withDynamicTable()
public RelOptFixture withFactory(UnaryOperator<SqlTestFactory> transform)
public RelOptFixture withPre(org.apache.calcite.plan.hep.HepProgram preProgram)
public RelOptFixture withPreRule(org.apache.calcite.plan.RelOptRule... rules)
public RelOptFixture withPlanner(org.apache.calcite.plan.RelOptPlanner planner)
public RelOptFixture withProgram(org.apache.calcite.plan.hep.HepProgram program)
public RelOptFixture withRule(org.apache.calcite.plan.RelOptRule... rules)
public <T> RelOptFixture withHook(org.apache.calcite.runtime.Hook hook, Consumer<T> handler)
Hook.addThread(Consumer))
just before running the query, and remove the hook afterwards.public <V> RelOptFixture withProperty(org.apache.calcite.runtime.Hook hook, V value)
public RelOptFixture withRelBuilderSimplify(boolean simplify)
public RelOptFixture withExpand(boolean expand)
public RelOptFixture withConfig(UnaryOperator<org.apache.calcite.sql2rel.SqlToRelConverter.Config> transform)
public RelOptFixture withRelBuilderConfig(UnaryOperator<org.apache.calcite.tools.RelBuilder.Config> transform)
public RelOptFixture withLateDecorrelate(boolean lateDecorrelate)
public RelOptFixture withDecorrelate(boolean decorrelate)
public RelOptFixture withTrim(boolean trim)
public RelOptFixture withCatalogReaderFactory(SqlTestFactory.CatalogReaderFactory factory)
public RelOptFixture withConformance(org.apache.calcite.sql.validate.SqlConformance conformance)
public RelOptFixture withContext(UnaryOperator<org.apache.calcite.plan.Context> transform)
public org.apache.calcite.rel.RelNode toRel()
public void check()
withPre(HepProgram)
to prepare the tree.public void checkUnchanged()
public RelOptFixture withVolcanoPlanner(boolean topDown)
public RelOptFixture withVolcanoPlanner(boolean topDown, Consumer<org.apache.calcite.plan.volcano.VolcanoPlanner> init)
public RelOptFixture withSubQueryRules()
public DiffRepository diffRepos()
Copyright © 2012-2023 Apache Software Foundation. All Rights Reserved.