- All Implemented Interfaces:
public class RelOptRulesTest
- extends RelOptTestBase
Unit test for rules in
org.eigenbase.rel and subpackages.
As input, the test supplies a SQL statement and a single rule; the SQL is
translated into relational algebra and then fed into a
HepPlanner. The planner fires the rule on every
pattern match in a depth-first left-to-right preorder traversal of the tree
for as long as the rule continues to succeed in applying its transform. (For
rules which call transformTo more than once, only the last result is used.)
The plan before and after "optimization" is diffed against a .ref file using
Procedure for adding a new test case:
- Add a new public test method for your rule, following the existing
examples. You'll have to come up with an SQL statement to which your rule
will apply in a meaningful way. See
SqlToRelTestBase class comments
for details on the schema.
- Run the test. It should fail. Inspect the output in
RelOptRulesTest.log.xml; verify that the "planBefore" is the correct
translation of your SQL, and that it contains the pattern on which your rule
is supposed to fire. If all is well, check out RelOptRulesTest.ref.xml and
replace it with the new .log.xml.
- Run the test again. It should fail again, but this time it should contain
a "planAfter" entry for your rule. Verify that your rule applied its
transformation correctly, and then update the .ref.xml file again.
- Run the test one last time; this time it should pass.
- $Id: //open/dev/farrago/src/org/eigenbase/test/RelOptRulesTest.java#15 $
- John V. Sichi
|Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
|Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
protected DiffRepository getDiffRepos()
- Description copied from class:
- Returns the default diff repository for this test, or null if there is
The default implementation returns null.
Sub-classes that want to use a diff repository can override.
Sub-sub-classes can override again, inheriting test cases and overriding
selected test results.
And individual test cases can override by providing a different
getDiffRepos in class
- Diff repository
public void testUnionToDistinctRule()
public void testExtractJoinFilterRule()
public void testAddRedundantSemiJoinRule()
public void testPushFilterThroughOuterJoin()
public void testReduceAverage()
public void testPushProjectPastFilter()
public void testPushProjectPastJoin()
public void testPushProjectPastSetOp()