Class RelOptRulesTest
- java.lang.Object
-
- org.apache.calcite.test.SqlToRelTestBase
-
- org.apache.calcite.test.RelOptTestBase
-
- org.apache.calcite.test.RelOptRulesTest
-
public class RelOptRulesTest extends RelOptTestBase
Unit test for rules inorg.apache.calcite.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 pre-order 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 usingDiffRepository
.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
target/surefire/.../RelOptRulesTest.xml
. (If you are running using maven and this file does not exist, add a-X
flag to the maven command line.) - 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, replace
src/test/resources/.../RelOptRulesTest.xml
and with the newtarget/surefire/.../RelOptRulesTest.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
src/test/resources/.../RelOptRulesTest.xml
file again. - Run the test one last time; this time it should pass.
- 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.test.RelOptTestBase
RelOptTestBase.Sql
-
Nested classes/interfaces inherited from class org.apache.calcite.test.SqlToRelTestBase
SqlToRelTestBase.MockRelOptSchema, SqlToRelTestBase.Tester, SqlToRelTestBase.TesterImpl
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
NOT_STRONG_EXPR
private org.apache.calcite.rel.rules.PushProjector.ExprCondition
skipItem
private static java.lang.String
STRONG_EXPR
-
Fields inherited from class org.apache.calcite.test.SqlToRelTestBase
NL, tester
-
-
Constructor Summary
Constructors Constructor Description RelOptRulesTest()
-
Method Summary
-
Methods inherited from class org.apache.calcite.test.RelOptTestBase
checkPlanning, checkPlanning, checkPlanning, checkPlanning, checkPlanning, checkPlanningDynamic, checkPlanningDynamic, checkPlanUnchanged, createDynamicTester, createTester, sql
-
Methods inherited from class org.apache.calcite.test.SqlToRelTestBase
assertValid, createTester, getTesterWithDynamicTable
-
-
-
-
Field Detail
-
skipItem
private final org.apache.calcite.rel.rules.PushProjector.ExprCondition skipItem
-
NOT_STRONG_EXPR
private static final java.lang.String NOT_STRONG_EXPR
- See Also:
- Constant Field Values
-
STRONG_EXPR
private static final java.lang.String STRONG_EXPR
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDiffRepos
protected DiffRepository getDiffRepos()
Description copied from class:SqlToRelTestBase
Returns the default diff repository for this test, or null if there is no repository.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 tester object.
- Overrides:
getDiffRepos
in classSqlToRelTestBase
- Returns:
- Diff repository
-
testReduceNot
public void testReduceNot()
-
testReduceNestedCaseWhen
public void testReduceNestedCaseWhen()
-
testReduceCompositeInSubQuery
public void testReduceCompositeInSubQuery()
-
testReduceOrCaseWhen
public void testReduceOrCaseWhen()
-
testReduceNullableCase
public void testReduceNullableCase()
-
testReduceNullableCase2
public void testReduceNullableCase2()
-
testProjectToWindowRuleForMultipleWindows
public void testProjectToWindowRuleForMultipleWindows()
-
testUnionToDistinctRule
public void testUnionToDistinctRule()
-
testExtractJoinFilterRule
public void testExtractJoinFilterRule()
-
testAddRedundantSemiJoinRule
public void testAddRedundantSemiJoinRule()
-
testStrengthenJoinType
public void testStrengthenJoinType()
-
testFullOuterJoinSimplificationToLeftOuter
public void testFullOuterJoinSimplificationToLeftOuter()
-
testFullOuterJoinSimplificationToRightOuter
public void testFullOuterJoinSimplificationToRightOuter()
-
testFullOuterJoinSimplificationToInner
public void testFullOuterJoinSimplificationToInner()
-
testLeftOuterJoinSimplificationToInner
public void testLeftOuterJoinSimplificationToInner()
-
testRightOuterJoinSimplificationToInner
public void testRightOuterJoinSimplificationToInner()
-
testPushFilterPastAgg
public void testPushFilterPastAgg()
-
basePushFilterPastAggWithGroupingSets
private void basePushFilterPastAggWithGroupingSets(boolean unchanged) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushFilterPastAggWithGroupingSets1
public void testPushFilterPastAggWithGroupingSets1() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushFilterPastAggWithGroupingSets2
public void testPushFilterPastAggWithGroupingSets2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushFilterPastAggTwo
public void testPushFilterPastAggTwo()
-
testPushFilterPastAggThree
public void testPushFilterPastAggThree()
Test case for [CALCITE-799] Incorrect result forHAVING count(*) > 1
.
-
testPushFilterPastAggFour
public void testPushFilterPastAggFour()
-
testPushFilterPastProject
public void testPushFilterPastProject()
-
testJoinProjectTranspose
public void testJoinProjectTranspose()
-
testSortUnionTranspose
public void testSortUnionTranspose()
Test case for [CALCITE-889] Implement SortUnionTransposeRule.
-
testSortUnionTranspose2
public void testSortUnionTranspose2()
Test case for [CALCITE-889] Implement SortUnionTransposeRule.
-
testSortUnionTranspose3
public void testSortUnionTranspose3()
Test case for [CALCITE-987] Push limit 0 will result in an infinite loop.
-
testSortRemovalAllKeysConstant
public void testSortRemovalAllKeysConstant()
-
testSortRemovalOneKeyConstant
public void testSortRemovalOneKeyConstant()
-
testSemiJoinRuleExists
public void testSemiJoinRuleExists()
-
testSemiJoinRule
public void testSemiJoinRule()
-
testSemiJoinRuleRight
public void testSemiJoinRuleRight()
-
testSemiJoinRuleFull
public void testSemiJoinRuleFull()
Similar totestSemiJoinRuleRight()
but FULL.
-
testSemiJoinRuleLeft
public void testSemiJoinRuleLeft()
Similar totestSemiJoinRule()
but LEFT.
-
testPushFilterThroughSemiJoin
public void testPushFilterThroughSemiJoin()
Test case for [CALCITE-438] Push predicates through SemiJoin.
-
testSemiJoinReduceConstants
public void testSemiJoinReduceConstants()
-
testSemiJoinTrim
public void testSemiJoinTrim() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceAverage
public void testReduceAverage()
-
testCastInAggregateReduceFunctions
public void testCastInAggregateReduceFunctions()
-
testDistinctCountWithoutGroupBy
public void testDistinctCountWithoutGroupBy()
-
testDistinctCount1
public void testDistinctCount1()
-
testDistinctCount2
public void testDistinctCount2()
-
testDistinctCount3
public void testDistinctCount3()
-
testDistinctCountMultipleViaJoin
public void testDistinctCountMultipleViaJoin()
Tests implementing multiple distinct count the old way, using a join.
-
testDistinctCountMultiple
public void testDistinctCountMultiple()
Tests implementing multiple distinct count the new way, using GROUPING SETS.
-
testDistinctCountMultipleNoGroup
public void testDistinctCountMultipleNoGroup()
-
testDistinctCountMixedJoin
public void testDistinctCountMixedJoin()
-
testDistinctCountMixed
public void testDistinctCountMixed()
-
testDistinctCountMixed2
public void testDistinctCountMixed2()
-
testDistinctCountGroupingSets1
public void testDistinctCountGroupingSets1()
-
testDistinctCountGroupingSets2
public void testDistinctCountGroupingSets2()
-
testDistinctNonDistinctAggregates
public void testDistinctNonDistinctAggregates()
-
testCastInAggregateExpandDistinctAggregatesRule
public void testCastInAggregateExpandDistinctAggregatesRule()
-
testDistinctNonDistinctAggregatesWithGrouping1
public void testDistinctNonDistinctAggregatesWithGrouping1()
-
testDistinctNonDistinctAggregatesWithGrouping2
public void testDistinctNonDistinctAggregatesWithGrouping2()
-
testDistinctNonDistinctTwoAggregatesWithGrouping
public void testDistinctNonDistinctTwoAggregatesWithGrouping()
-
testDistinctWithGrouping
public void testDistinctWithGrouping()
-
testMultipleDistinctWithGrouping
public void testMultipleDistinctWithGrouping()
-
testDistinctWithMultipleInputs
public void testDistinctWithMultipleInputs()
-
testDistinctWithMultipleInputsAndGroupby
public void testDistinctWithMultipleInputsAndGroupby()
-
testPushProjectPastFilter
public void testPushProjectPastFilter()
-
testPushProjectPastFilter2
public void testPushProjectPastFilter2()
-
testPushProjectPastJoin
public void testPushProjectPastJoin()
-
testProjectCorrelateTransposeDynamic
public void testProjectCorrelateTransposeDynamic()
-
testProjectCorrelateTransposeRuleLeftCorrelate
public void testProjectCorrelateTransposeRuleLeftCorrelate()
-
testProjectCorrelateTransposeRuleSemiCorrelate
public void testProjectCorrelateTransposeRuleSemiCorrelate()
-
testProjectCorrelateTransposeRuleAntiCorrelate
public void testProjectCorrelateTransposeRuleAntiCorrelate()
-
testProjectCorrelateTransposeWithExprCond
public void testProjectCorrelateTransposeWithExprCond()
-
testProjectCorrelateTranspose
public void testProjectCorrelateTranspose()
-
testFilterProjectTransposePreventedByCorrelation
public void testFilterProjectTransposePreventedByCorrelation()
Tests that the default instance ofFilterProjectTransposeRule
does not push a Filter that contains a correlating variable.- See Also:
testFilterProjectTranspose()
-
testFilterProjectTranspose
public void testFilterProjectTranspose()
Tests a variant ofFilterProjectTransposeRule
that pushes a Filter that contains a correlating variable.
-
testPushProjectPastInnerJoin
public void testPushProjectPastInnerJoin()
-
testPushProjectPastInnerJoinStrong
public void testPushProjectPastInnerJoinStrong()
-
testPushProjectPastLeftJoin
public void testPushProjectPastLeftJoin()
-
testPushProjectPastLeftJoinSwap
public void testPushProjectPastLeftJoinSwap()
-
testPushProjectPastLeftJoinSwapStrong
public void testPushProjectPastLeftJoinSwapStrong()
-
testPushProjectPastRightJoin
public void testPushProjectPastRightJoin()
-
testPushProjectPastRightJoinStrong
public void testPushProjectPastRightJoinStrong()
-
testPushProjectPastRightJoinSwap
public void testPushProjectPastRightJoinSwap()
-
testPushProjectPastRightJoinSwapStrong
public void testPushProjectPastRightJoinSwapStrong()
-
testPushProjectPastFullJoin
public void testPushProjectPastFullJoin()
-
testPushProjectPastFullJoinStrong
public void testPushProjectPastFullJoinStrong()
-
testPushProjectPastSetOp
public void testPushProjectPastSetOp()
-
testPushJoinThroughUnionOnLeft
public void testPushJoinThroughUnionOnLeft()
-
testPushJoinThroughUnionOnRight
public void testPushJoinThroughUnionOnRight()
-
testMergeFilterWithJoinCondition
public void testMergeFilterWithJoinCondition() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testMergeFilter
public void testMergeFilter() throws java.lang.Exception
Tests that filters are combined if they are identical.- Throws:
java.lang.Exception
-
testUnionMergeRule
public void testUnionMergeRule() throws java.lang.Exception
Tests to see if the final branch of union is missed- Throws:
java.lang.Exception
-
testMinusMergeRule
public void testMinusMergeRule() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testMergeJoinFilter
public void testMergeJoinFilter() throws java.lang.Exception
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.- Throws:
java.lang.Exception
-
testMergeUnionAll
public void testMergeUnionAll() throws java.lang.Exception
TestsUnionMergeRule
, which merges 2Union
operators into a singleUnion
with 3 inputs.- Throws:
java.lang.Exception
-
testMergeUnionDistinct
public void testMergeUnionDistinct() throws java.lang.Exception
TestsUnionMergeRule
, which merges 2Union
DISTINCT
(notALL
) operators into a singleUnion
with 3 inputs.- Throws:
java.lang.Exception
-
testMergeUnionMixed
public void testMergeUnionMixed() throws java.lang.Exception
Tests thatUnionMergeRule
does nothing if its arguments have differentALL
settings.- Throws:
java.lang.Exception
-
testMergeUnionMixed2
public void testMergeUnionMixed2() throws java.lang.Exception
Tests thatUnionMergeRule
converts all inputs to DISTINCT if the top one is DISTINCT. (Since UNION is left-associative, the "top one" is the rightmost.)- Throws:
java.lang.Exception
-
testMergeSetOpMixed
public void testMergeSetOpMixed() throws java.lang.Exception
Tests thatUnionMergeRule
does nothing if its arguments have are different set operators,Union
andIntersect
.- Throws:
java.lang.Exception
-
testMergeIntersect
public void testMergeIntersect() throws java.lang.Exception
TestsUnionMergeRule.INTERSECT_INSTANCE
, which merges 2Intersect
operators into a singleIntersect
with 3 inputs.- Throws:
java.lang.Exception
-
testIntersectToDistinct
public void testIntersectToDistinct() throws java.lang.Exception
TestsIntersectToDistinctRule
, which rewrites anIntersect
operator with 3 inputs.- Throws:
java.lang.Exception
-
testIntersectToDistinctAll
public void testIntersectToDistinctAll() throws java.lang.Exception
Tests thatIntersectToDistinctRule
correctly ignores anINTERSECT ALL
. It can only handleINTERSECT DISTINCT
.- Throws:
java.lang.Exception
-
testMergeMinus
public void testMergeMinus() throws java.lang.Exception
TestsUnionMergeRule.MINUS_INSTANCE
, which merges 2Minus
operators into a singleMinus
with 3 inputs.- Throws:
java.lang.Exception
-
testMergeMinusRightDeep
public void testMergeMinusRightDeep() throws java.lang.Exception
TestsUnionMergeRule.MINUS_INSTANCE
does not mergeMinus(a, Minus(b, c))
intoMinus(a, b, c)
, which would be incorrect.- Throws:
java.lang.Exception
-
testHeterogeneousConversion
public void testHeterogeneousConversion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSemiJoinPastJoinRuleLeft
public void testPushSemiJoinPastJoinRuleLeft() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSemiJoinPastJoinRuleRight
public void testPushSemiJoinPastJoinRuleRight() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSemiJoinPastFilter
public void testPushSemiJoinPastFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testConvertMultiJoinRule
public void testConvertMultiJoinRule() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstants
public void testReduceConstants() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsDup
public void testReduceConstantsDup() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsDup2
public void testReduceConstantsDup2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullNull
public void testPullNull() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testOrAlwaysTrue
public void testOrAlwaysTrue()
-
testOrAlwaysTrue2
public void testOrAlwaysTrue2()
-
testReduceConstants2
public void testReduceConstants2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstants3
public void testReduceConstants3() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsProjectNullable
public void testReduceConstantsProjectNullable() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsNullEqualsOne
public void testReduceConstantsNullEqualsOne() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsCaseEquals
public void testReduceConstantsCaseEquals() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsCaseEquals2
public void testReduceConstantsCaseEquals2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsCaseEquals3
public void testReduceConstantsCaseEquals3() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testSkipReduceConstantsCaseEquals
public void testSkipReduceConstantsCaseEquals() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsEliminatesFilter
public void testReduceConstantsEliminatesFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsNull
public void testReduceConstantsNull() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsRequiresExecutor
public void testReduceConstantsRequiresExecutor() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAlreadyFalseEliminatesFilter
public void testAlreadyFalseEliminatesFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsCalc
public void testReduceConstantsCalc() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoveSemiJoin
public void testRemoveSemiJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoveSemiJoinWithFilter
public void testRemoveSemiJoinWithFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoveSemiJoinRight
public void testRemoveSemiJoinRight() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoveSemiJoinRightWithFilter
public void testRemoveSemiJoinRightWithFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
checkPlanning
private void checkPlanning(java.lang.String query) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testConvertMultiJoinRuleOuterJoins
public void testConvertMultiJoinRuleOuterJoins() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testConvertMultiJoinRuleOuterJoins2
public void testConvertMultiJoinRuleOuterJoins2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testConvertMultiJoinRuleOuterJoins3
public void testConvertMultiJoinRuleOuterJoins3() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testConvertMultiJoinRuleOuterJoins4
public void testConvertMultiJoinRuleOuterJoins4() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSemiJoinPastProject
public void testPushSemiJoinPastProject() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceValuesUnderFilter
public void testReduceValuesUnderFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceValuesUnderProject
public void testReduceValuesUnderProject() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceValuesUnderProjectFilter
public void testReduceValuesUnderProjectFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceCase
public void testReduceCase() throws java.lang.Exception
Test case for [CALCITE-1439] Handling errors during constant reduction.- Throws:
java.lang.Exception
-
checkReduceNullableToNotNull
private void checkReduceNullableToNotNull(org.apache.calcite.rel.rules.ReduceExpressionsRule rule)
-
testReduceNullableToNotNull
public void testReduceNullableToNotNull() throws java.lang.Exception
Test case that reduces a nullable expression to a NOT NULL literal that is cast to nullable.- Throws:
java.lang.Exception
-
testReduceNullableToNotNull2
public void testReduceNullableToNotNull2() throws java.lang.Exception
Test case that reduces a nullable expression to a NOT NULL literal.- Throws:
java.lang.Exception
-
testReduceConstantsIsNull
public void testReduceConstantsIsNull() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsIsNotNull
public void testReduceConstantsIsNotNull() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsNegated
public void testReduceConstantsNegated() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsNegatedInverted
public void testReduceConstantsNegatedInverted() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceConstantsNonDeterministicFunction
public void testReduceConstantsNonDeterministicFunction()
-
testReduceConstantsDynamicFunction
public void testReduceConstantsDynamicFunction()
Checks that constant reducer duplicates calls to dynamic functions, if appropriate. CURRENT_TIMESTAMP is a dynamic function.
-
testCasePushIsAlwaysWorking
public void testCasePushIsAlwaysWorking() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceValuesNull
public void testReduceValuesNull() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceValuesToEmpty
public void testReduceValuesToEmpty() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testEmptyFilterProjectUnion
public void testEmptyFilterProjectUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testEmptyProject
public void testEmptyProject() throws java.lang.Exception
Test case for [CALCITE-1488] ValuesReduceRule should ignore empty Values.- Throws:
java.lang.Exception
-
testEmptyProject2
public void testEmptyProject2() throws java.lang.Exception
Same query astestEmptyProject()
, andPruneEmptyRules
is able to do the job thatValuesReduceRule
cannot do.- Throws:
java.lang.Exception
-
testEmptyIntersect
public void testEmptyIntersect() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testEmptyMinus
public void testEmptyMinus() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testEmptyMinus2
public void testEmptyMinus2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testEmptyJoin
public void testEmptyJoin()
-
testEmptyJoinLeft
public void testEmptyJoinLeft()
-
testEmptyJoinRight
public void testEmptyJoinRight()
-
testEmptySort
public void testEmptySort()
-
testEmptySortLimitZero
public void testEmptySortLimitZero()
-
testEmptyAggregate
public void testEmptyAggregate()
-
testEmptyAggregateEmptyKey
public void testEmptyAggregateEmptyKey()
-
testEmptyAggregateEmptyKeyWithAggregateValuesRule
public void testEmptyAggregateEmptyKeyWithAggregateValuesRule()
-
testReduceCasts
public void testReduceCasts() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceCastTimeUnchanged
public void testReduceCastTimeUnchanged() throws java.lang.Exception
Tests that a cast from a TIME to a TIMESTAMP is not reduced. It is not constant because the result depends upon the current date.- Throws:
java.lang.Exception
-
testReduceCastAndConsts
public void testReduceCastAndConsts() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceCaseNullabilityChange
public <T> void testReduceCaseNullabilityChange() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testReduceCastsNullable
public void testReduceCastsNullable() throws java.lang.Exception
- Throws:
java.lang.Exception
-
basePushAggThroughUnion
private void basePushAggThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumConstantThroughUnion
public void testPushSumConstantThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumNullConstantThroughUnion
public void testPushSumNullConstantThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumNullableThroughUnion
public void testPushSumNullableThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumNullableNOGBYThroughUnion
public void testPushSumNullableNOGBYThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushCountStarThroughUnion
public void testPushCountStarThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushCountNullableThroughUnion
public void testPushCountNullableThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushMaxNullableThroughUnion
public void testPushMaxNullableThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushMinThroughUnion
public void testPushMinThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushAvgThroughUnion
public void testPushAvgThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumCountStarThroughUnion
public void testPushSumCountStarThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumConstantGroupingSetsThroughUnion
public void testPushSumConstantGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumNullConstantGroupingSetsThroughUnion
public void testPushSumNullConstantGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumNullableGroupingSetsThroughUnion
public void testPushSumNullableGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushCountStarGroupingSetsThroughUnion
public void testPushCountStarGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushCountNullableGroupingSetsThroughUnion
public void testPushCountNullableGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushMaxNullableGroupingSetsThroughUnion
public void testPushMaxNullableGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushMinGroupingSetsThroughUnion
public void testPushMinGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushAvgGroupingSetsThroughUnion
public void testPushAvgGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushSumCountStarGroupingSetsThroughUnion
public void testPushSumCountStarGroupingSetsThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushCountFilterThroughUnion
public void testPushCountFilterThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullFilterThroughAggregate
public void testPullFilterThroughAggregate() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullFilterThroughAggregateGroupingSets
public void testPullFilterThroughAggregateGroupingSets() throws java.lang.Exception
- Throws:
java.lang.Exception
-
basePullConstantTroughAggregate
private void basePullConstantTroughAggregate() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughConstLast
public void testPullConstantThroughConstLast() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregateSimpleNonNullable
public void testPullConstantThroughAggregateSimpleNonNullable() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregatePermuted
public void testPullConstantThroughAggregatePermuted() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregatePermutedConstFirst
public void testPullConstantThroughAggregatePermutedConstFirst() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregatePermutedConstGroupBy
public void testPullConstantThroughAggregatePermutedConstGroupBy() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregateConstGroupBy
public void testPullConstantThroughAggregateConstGroupBy() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregateAllConst
public void testPullConstantThroughAggregateAllConst() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughAggregateAllLiterals
public void testPullConstantThroughAggregateAllLiterals() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughUnion
public void testPullConstantThroughUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughUnion2
public void testPullConstantThroughUnion2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantThroughUnion3
public void testPullConstantThroughUnion3() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAggregateProjectMerge
public void testAggregateProjectMerge()
-
testAggregateGroupingSetsProjectMerge
public void testAggregateGroupingSetsProjectMerge()
-
testAggregateExtractProjectRule
public void testAggregateExtractProjectRule()
-
testAggregateExtractProjectRuleWithGroupingSets
public void testAggregateExtractProjectRuleWithGroupingSets()
-
testAggregateExtractProjectRuleWithGroupingSets2
public void testAggregateExtractProjectRuleWithGroupingSets2()
Test with column used in both grouping set and argument to aggregate function.
-
testAggregateExtractProjectRuleWithFilter
public void testAggregateExtractProjectRuleWithFilter()
-
testPullAggregateThroughUnion
public void testPullAggregateThroughUnion()
-
testPullAggregateThroughUnion2
public void testPullAggregateThroughUnion2()
-
transitiveInference
private void transitiveInference(org.apache.calcite.plan.RelOptRule... extraRules) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceJoin
public void testTransitiveInferenceJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceProject
public void testTransitiveInferenceProject() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceAggregate
public void testTransitiveInferenceAggregate() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceUnion
public void testTransitiveInferenceUnion() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceJoin3way
public void testTransitiveInferenceJoin3way() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceJoin3wayAgg
public void testTransitiveInferenceJoin3wayAgg() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceLeftOuterJoin
public void testTransitiveInferenceLeftOuterJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceRightOuterJoin
public void testTransitiveInferenceRightOuterJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceFullOuterJoin
public void testTransitiveInferenceFullOuterJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferencePreventProjectPullUp
public void testTransitiveInferencePreventProjectPullUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferencePullUpThruAlias
public void testTransitiveInferencePullUpThruAlias() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceConjunctInPullUp
public void testTransitiveInferenceConjunctInPullUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceNoPullUpExprs
public void testTransitiveInferenceNoPullUpExprs() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceUnion3way
public void testTransitiveInferenceUnion3way() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceUnion3wayOr
public void testTransitiveInferenceUnion3wayOr() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceUnionAlwaysTrue
public void testTransitiveInferenceUnionAlwaysTrue() throws java.lang.Exception
Test case for [CALCITE-443] getPredicates from a union is not correct.- Throws:
java.lang.Exception
-
testTransitiveInferenceConstantEquiPredicate
public void testTransitiveInferenceConstantEquiPredicate() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testTransitiveInferenceComplexPredicate
public void testTransitiveInferenceComplexPredicate() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantIntoProject
public void testPullConstantIntoProject() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantIntoFilter
public void testPullConstantIntoFilter() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testSimplifyFilter
public void testSimplifyFilter() throws java.lang.Exception
Test case for [CALCITE-1995] Remove predicates from Filter if they can be proved to be always true or false.- Throws:
java.lang.Exception
-
testPullConstantIntoJoin
public void testPullConstantIntoJoin() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPullConstantIntoJoin2
public void testPullConstantIntoJoin2() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testCorrelationScalarAggAndFilter
public void testCorrelationScalarAggAndFilter()
-
testProjectWindowTransposeRule
public void testProjectWindowTransposeRule()
-
testProjectWindowTransposeRuleWithConstants
public void testProjectWindowTransposeRuleWithConstants()
-
testAggregateProjectPullUpConstants
public void testAggregateProjectPullUpConstants()
-
testAggregateProjectPullUpConstants2
public void testAggregateProjectPullUpConstants2()
-
testPushFilterWithRank
public void testPushFilterWithRank() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPushFilterWithRankExpr
public void testPushFilterWithRankExpr() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpressionInWindowFunction
public void testExpressionInWindowFunction()
-
testWindowInParenthesis
public void testWindowInParenthesis()
Test case for [CALCITE-888] Overlay window loses PARTITION BY list.
-
testNestedAggregates
public void testNestedAggregates()
-
testWindowFunctionOnAggregations
public void testWindowFunctionOnAggregations()
Test case for [CALCITE-2078] Aggregate functions in OVER clause.
-
testPushAggregateThroughJoin1
public void testPushAggregateThroughJoin1()
-
testPushAggregateThroughJoin2
public void testPushAggregateThroughJoin2()
-
testPushAggregateThroughJoin3
public void testPushAggregateThroughJoin3()
-
testPushAggregateThroughJoin4
public void testPushAggregateThroughJoin4()
-
testPushAggregateThroughJoin5
public void testPushAggregateThroughJoin5()
-
testJoinPushTransitivePredicatesRule
public void testJoinPushTransitivePredicatesRule()
-
testJoinPushTransitivePredicatesRule2
public void testJoinPushTransitivePredicatesRule2()
-
testInferringPredicatesWithNotOperatorInJoinCondition
public void testInferringPredicatesWithNotOperatorInJoinCondition()
-
testPushAggregateThroughJoin6
public void testPushAggregateThroughJoin6()
-
testPushAggregateThroughJoinWithUniqueInput
public void testPushAggregateThroughJoinWithUniqueInput()
-
testPushAggregateSumThroughJoin
public void testPushAggregateSumThroughJoin()
SUM is the easiest aggregate function to split.
-
testPushAggregateSumWithoutGroupKeyThroughJoin
public void testPushAggregateSumWithoutGroupKeyThroughJoin()
-
testPushAggregateSumThroughJoinAfterAggregateReduce
public void testPushAggregateSumThroughJoinAfterAggregateReduce()
Test case for [CALCITE-2108] AggregateJoinTransposeRule incorrectly splits a SUM0 call when Aggregate has no group keys.Similar to
testPushAggregateSumThroughJoin()
, but also usesAggregateReduceFunctionsRule
.
-
testPushAggregateFunctionsThroughJoin
public void testPushAggregateFunctionsThroughJoin()
Push a variety of aggregate functions.
-
testPushAggregateThroughJoinDistinct
public void testPushAggregateThroughJoinDistinct()
Push a aggregate functions into a relation that is unique on the join key.
-
testPushAggregateSumNoGroup
public void testPushAggregateSumNoGroup()
Push count(*) through join, no GROUP BY.
-
testSwapOuterJoin
public void testSwapOuterJoin()
-
testPushJoinCondDownToProject
public void testPushJoinCondDownToProject()
-
testSortJoinTranspose1
public void testSortJoinTranspose1()
-
testSortJoinTranspose2
public void testSortJoinTranspose2()
-
testSortJoinTranspose3
public void testSortJoinTranspose3()
-
testSortJoinTranspose4
public void testSortJoinTranspose4()
-
testSortJoinTranspose5
public void testSortJoinTranspose5()
-
testSortJoinTranspose6
public void testSortJoinTranspose6()
-
testSortJoinTranspose7
public void testSortJoinTranspose7()
-
testSortProjectTranspose1
public void testSortProjectTranspose1()
-
testSortProjectTranspose2
public void testSortProjectTranspose2()
-
testSortProjectTranspose3
public void testSortProjectTranspose3()
-
testAggregateConstantKeyRule
public void testAggregateConstantKeyRule()
-
testAggregateConstantKeyRule2
public void testAggregateConstantKeyRule2()
TestsAggregateProjectPullUpConstantsRule
where reduction is not possible because "deptno" is the only key.
-
testAggregateConstantKeyRule3
public void testAggregateConstantKeyRule3()
TestsAggregateProjectPullUpConstantsRule
where both keys are constants but only one can be removed.
-
testReduceExpressionsNot
public void testReduceExpressionsNot()
-
checkSubQuery
private RelOptTestBase.Sql checkSubQuery(java.lang.String sql)
-
testExpandProjectScalar
public void testExpandProjectScalar() throws java.lang.Exception
Tests expanding a sub-query, specifically an uncorrelated scalar sub-query in a project (SELECT clause).- Throws:
java.lang.Exception
-
testWhereNotInCorrelated
public void testWhereNotInCorrelated()
Test case for [CALCITE-1493] Wrong plan for NOT IN correlated queries.
-
testWhereNotInCorrelated2
public void testWhereNotInCorrelated2()
-
testAll
public void testAll()
-
testSome
public void testSome()
-
testWhereOrSubQuery
public void testWhereOrSubQuery()
Test case for [CALCITE-1546] Sub-queries connected by OR.
-
testExpandProjectIn
public void testExpandProjectIn() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandProjectInNullable
public void testExpandProjectInNullable() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandProjectInComposite
public void testExpandProjectInComposite() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandProjectExists
public void testExpandProjectExists() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandFilterScalar
public void testExpandFilterScalar() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandFilterIn
public void testExpandFilterIn() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandFilterInComposite
public void testExpandFilterInComposite() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandFilterIn3Value
public void testExpandFilterIn3Value() throws java.lang.Exception
An IN filter that requires full 3-value logic (true, false, unknown).- Throws:
java.lang.Exception
-
testExpandFilterExists
public void testExpandFilterExists() throws java.lang.Exception
An EXISTS filter that can be converted into true/false.- Throws:
java.lang.Exception
-
testExpandFilterExistsSimple
public void testExpandFilterExistsSimple() throws java.lang.Exception
An EXISTS filter that can be converted into a semi-join.- Throws:
java.lang.Exception
-
testExpandFilterExistsSimpleAnd
public void testExpandFilterExistsSimpleAnd() throws java.lang.Exception
An EXISTS filter that can be converted into a semi-join.- Throws:
java.lang.Exception
-
testExpandJoinScalar
public void testExpandJoinScalar() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandJoinIn
public void testExpandJoinIn() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandJoinInComposite
public void testExpandJoinInComposite() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testExpandJoinExists
public void testExpandJoinExists() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testDecorrelateExists
public void testDecorrelateExists() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testDecorrelateTwoExists
public void testDecorrelateTwoExists() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testDecorrelateUncorrelatedInAndCorrelatedExists
public void testDecorrelateUncorrelatedInAndCorrelatedExists() throws java.lang.Exception
Test case for [CALCITE-2028] Un-correlated IN sub-query should be converted into a Join, rather than a Correlate without correlation variables .- Throws:
java.lang.Exception
-
testDecorrelateTwoIn
public void testDecorrelateTwoIn() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testDecorrelateTwoScalar
public void testDecorrelateTwoScalar() throws java.lang.Exception
Test case for [CALCITE-1045] Decorrelate sub-queries in Project and Join, with the added complication that there are two sub-queries.- Throws:
java.lang.Exception
-
testWhereInJoinCorrelated
public void testWhereInJoinCorrelated()
-
testWhereInCorrelated
public void testWhereInCorrelated()
Test case for [CALCITE-1494] Inefficient plan for correlated sub-queries. In "planAfter", there must be only one scan each of emp and dept. We don't need a separate value-generator for emp.job.
-
testWhereExpressionInCorrelated
public void testWhereExpressionInCorrelated()
-
testWhereExpressionInCorrelated2
public void testWhereExpressionInCorrelated2()
-
testExpandWhereComparisonCorrelated
public void testExpandWhereComparisonCorrelated() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testCustomColumnResolvingInNonCorrelatedSubQuery
public void testCustomColumnResolvingInNonCorrelatedSubQuery()
-
testCustomColumnResolvingInCorrelatedSubQuery
public void testCustomColumnResolvingInCorrelatedSubQuery()
-
testCustomColumnResolvingInCorrelatedSubQuery2
public void testCustomColumnResolvingInCorrelatedSubQuery2()
-
testExtractYearToRange
public void testExtractYearToRange()
Test case for [CALCITE-434] Converting predicates on date dimension columns into date ranges, specifically a rule that convertsEXTRACT(YEAR FROM ...) = constant
to a range.
-
testExtractYearMonthToRange
public void testExtractYearMonthToRange()
-
testFilterRemoveIsNotDistinctFromRule
public void testFilterRemoveIsNotDistinctFromRule()
-
testOversimplifiedCaseStatement
public void testOversimplifiedCaseStatement()
-
testNoOversimplificationBelowIsNull
public void testNoOversimplificationBelowIsNull()
-
-