[ 
https://issues.apache.org/jira/browse/CALCITE-2223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16753049#comment-16753049
 ] 

Volodymyr Vysotskyi commented on CALCITE-2223:
----------------------------------------------

[~vladimirsitnikov] , thanks a lot for debugging this issue from drill side.

I have run Drill tests for the changes from the PR, and it causes failures for 
many drill tests:
{noformat}
[ERROR] Errors: 
[ERROR]   TestAltSortQueries.testJoinWithLimit » UserRemote SYSTEM ERROR: 
CannotPlanExce...
[ERROR]   TestBugFixes.DRILL883 » UserRemote SYSTEM ERROR: CannotPlanException: 
Node [re...
[ERROR]   
TestBugFixes.testDRILL2361_JoinColumnAliasWithDots:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestBugFixes.testDRILL5269 » UserRemote UNSUPPORTED_OPERATION ERROR: 
This quer...
[ERROR]   TestCaseSensitivity.testCaseSenWhenQueryTwoDiffCols:56 »  
org.apache.drill.com...
[ERROR]   
TestCorrelation.testSeveralExistsCorrelateSubquery:105->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestExampleQueries.testDRILL_811ViewJoin » UserRemote SYSTEM ERROR: 
CannotPlan...
[ERROR]   TestExampleQueries.testJoinExpOn » UserRemote SYSTEM ERROR: 
CannotPlanExceptio...
[ERROR]   TestExampleQueries.testNestedTypesPastJoinReportsValidResult:677 »  
org.apache...
[ERROR]   TestExampleQueries.testPushExpInJoinConditionRightJoin » UserRemote 
SYSTEM ERR...
[ERROR]   
TestExampleQueries.testRepeatedListProjectionPastJoin:1012->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestExampleQueries.testTextJoin » UserRemote SYSTEM ERROR: 
CannotPlanException...
[ERROR]   TestExampleQueries.testViewFileName » UserRemote VALIDATION ERROR: A 
view with...
[ERROR]   
TestExampleQueries.testWindowFunAndStarCol:1070->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testFullJoinUsingUntypedNullColumn:572->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestJoinNullable.testHashFOJOnNullableColumns » UserRemote SYSTEM 
ERROR: Canno...
[ERROR]   TestJoinNullable.testHashInnerJoinOnNullableColumns » UserRemote 
SYSTEM ERROR:...
[ERROR]   TestJoinNullable.testHashLOJOnNullableColumns » UserRemote SYSTEM 
ERROR: Canno...
[ERROR]   TestJoinNullable.testHashROJOnNullableColumns » UserRemote SYSTEM 
ERROR: Canno...
[ERROR]   TestJoinNullable.testMergeInnerJoinOnNullableColumns » UserRemote 
SYSTEM ERROR...
[ERROR]   TestJoinNullable.testMergeLOJNullable » UserRemote SYSTEM ERROR: 
CannotPlanExc...
[ERROR]   TestJoinNullable.testMergeLOJNullableNoOrderedInputs » UserRemote 
SYSTEM ERROR...
[ERROR]   TestJoinNullable.testMergeLOJNullableOneOrderedInputAscNullsFirst » 
UserRemote
[ERROR]   TestJoinNullable.testMergeLOJNullableOneOrderedInputAscNullsLast » 
UserRemote ...
[ERROR]   TestJoinNullable.testMergeLOJNullableOneOrderedInputDescNullsFirst » 
UserRemote
[ERROR]   TestJoinNullable.testMergeLOJNullableOneOrderedInputDescNullsLast » 
UserRemote
[ERROR]   TestJoinNullable.testMergeROJOnNullableColumns » UserRemote SYSTEM 
ERROR: Cann...
[ERROR]   
TestJoinNullable.testMixedEqualAndEqualOrHashJoin:537->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testMixedEqualAndEqualOrMergeJoin:553->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testMixedEqualAndIsNotDistinctFilterHashJoin:505->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testMixedEqualAndIsNotDistinctFilterMergeJoin:521->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testMixedEqualAndIsNotDistinctHashJoin:475->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testMixedEqualAndIsNotDistinctMergeJoin:489->nullMixedComparatorEqualJoinHelper:587->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testNullEqualAdditionFilter:464->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testNullEqualHashJoin:417->nullEqualJoinHelper:447->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testNullEqualInWhereConditionHashJoin:394->nullEqualJoinHelper:447->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testNullEqualInWhereConditionMergeJoin:405->nullEqualJoinHelper:447->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinNullable.testNullEqualMergeJoin:428->nullEqualJoinHelper:447->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeFilterPlan.testDRILL_FilterMerge:48->PlanTestBase.testPlanSubstrPatterns:190->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestOperatorDump.testScanBatchChecked »  Unexpected exception, 
expected<org.ap...
[ERROR]   TestPartitionFilter.testDirPruningTransitivePredicates » UserRemote 
SYSTEM ERR...
[ERROR]   TestPartitionFilter.testPartitionFilter4_Csv » UserRemote SYSTEM 
ERROR: Cannot...
[ERROR]   TestPartitionFilter.testPartitionFilter4_Json » UserRemote SYSTEM 
ERROR: Canno...
[ERROR]   TestPartitionFilter.testPartitionFilter4_Parquet » UserRemote SYSTEM 
ERROR: Ca...
[ERROR]   TestPartitionFilter.testPartitionFilter4_Parquet_from_CTAS » 
UserRemote SYSTEM...
[ERROR]   
TestPartitionFilter.testPruneSameTableInJoin:428->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testJoin:80->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testProjectPastFilterPastJoinPastJoinPushDown:194->testPushDown:311->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testProjectPastFilterPastJoinPushDown:165->testPushDown:311->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testProjectPastFilterPastJoinPushDownWhenItemsAreWithinNestedOperators:179->testPushDown:311->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testProjectPastJoinPastFilterPastJoinPushDown:209->testPushDown:311->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testProjectPushdownPastJoinWithJoinPushExpressions:293->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestProjectPushDown.testSimpleProjectPastJoinPastFilterPastJoinPushDown:280->testPushDown:311->PlanTestBase.testPhysicalPlan:60->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestStarQueries.testCaseSenJoinCTEWithRegTab » UserRemote SYSTEM 
ERROR: Cannot...
[ERROR]   TestStarQueries.testDRILL_595WithClauseJoin » UserRemote SYSTEM 
ERROR: CannotP...
[ERROR]   TestStarQueries.testSelLeftStarJoin:206 »  
org.apache.drill.common.exceptions....
[ERROR]   TestStarQueries.testSelRightStarJoin:216 »  
org.apache.drill.common.exceptions...
[ERROR]   
TestStarQueries.testSelStarBothSideJoin:240->BaseTestQuery.testRunAndReturn:341 
» Rpc
[ERROR]   TestStarQueries.testSelStarJoin:196 »  
org.apache.drill.common.exceptions.User...
[ERROR]   TestStarQueries.testSelStarJoinSchemaWithSchemaLess » UserRemote 
SYSTEM ERROR:...
[ERROR]   TestStarQueries.testSelStarRegColConstJoin:230 »  
org.apache.drill.common.exce...
[ERROR]   TestStarQueries.testSelStarSubQJoin » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestStarQueries.testSelectStartSubQueryJoinWithWhereClause » 
UserRemote SYSTEM...
[ERROR]   
TestStarQueries.testStarInSubquery:450->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   TestStarQueries.testStarView1 » UserRemote SYSTEM ERROR: 
CannotPlanException: ...
[ERROR]   TestTextJoin.testTextJoin1 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch05 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch07 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch08 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch09 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch10 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch11 » UserRemote UNSUPPORTED_OPERATION ERROR: 
This quer...
[ERROR]   TestTpchDistributed.tpch13 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch14 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch15 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch18 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributed.tpch19_1 » UserRemote SYSTEM ERROR: 
CannotPlanException: N...
[ERROR]   TestTpchDistributed.tpch21 » UserRemote SYSTEM ERROR: 
CannotPlanException: Nod...
[ERROR]   TestTpchDistributedStreaming.tpch05 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch07 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch08 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch09 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch10 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch12 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch13 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch14 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch18 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch19_1 » UserRemote SYSTEM ERROR: 
CannotPlanExc...
[ERROR]   TestTpchDistributedStreaming.tpch20 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchDistributedStreaming.tpch21 » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestTpchExplain.tpch05 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch07 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch08 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch09 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch10 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch13 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch14 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch18 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   TestTpchExplain.tpch19_1 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node ...
[ERROR]   TestTpchExplain.tpch21 » UserRemote SYSTEM ERROR: 
CannotPlanException: Node [r...
[ERROR]   
TestTpchPlanning.tpch05:57->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestTpchPlanning.tpch07:67->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestTpchPlanning.tpch10:84->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestTpchPlanning.tpch14:106->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestTpchPlanning.tpch18:128->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestTpchPlanning.tpch21:145->PlanningBase.testSqlPlanFromFile:76->PlanningBase.testSqlPlan:144
 » CannotPlan
[ERROR]   
TestUnionAll.testDrill4833_1:1129->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestUnionAll.testDrill4833_2:1164->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestUnionAll.testInListOnUnionAll:689->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestUnionAll.testUnionAll2:86->BaseTestQuery.testRunAndReturn:341 » 
Rpc org.ap...
[ERROR]   
TestUnionDistinct.testInListPushDownOverUnionDistinct:602->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestUnionDistinct.testUnionDistinct2:82->BaseTestQuery.testRunAndReturn:341 » 
Rpc
[ERROR]   
TestWindowFunctions.testWindowWithJoin:396->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestLargeFileCompilation.testMergeJoin:222->BaseTestQuery.testNoResult:358->BaseTestQuery.testNoResult:384
 » Rpc
[ERROR]   
TestImpersonationQueries.testMultiLevelImpersonationJoinEachSideReachesMaxUserHops
 » UserRemote
[ERROR]   TestFastComplexSchema.test2 » UserRemote SYSTEM ERROR: 
CannotPlanException: No...
[ERROR]   TestFastComplexSchema.test3 » UserRemote SYSTEM ERROR: 
CannotPlanException: No...
[ERROR]   TestSchema.testLocal:104 » Rpc 
org.apache.drill.common.exceptions.UserRemoteEx...
[ERROR]   TestBroadcast.broadcastExecuteWorks » UserRemote SYSTEM ERROR: 
CannotPlanExcep...
[ERROR]   TestBroadcast.plansWithBroadcast » UserRemote SYSTEM ERROR: 
CannotPlanExceptio...
[ERROR]   
TestFlatten.testFlattenAfterJoin1:526->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   
TestFlatten.testFlattenAfterJoin2:537->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   
TestFlatten.testFlattenAfterJoin3:549->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   TestHashJoinAdvanced.testFOJWithRequiredTypes:96 »  
org.apache.drill.common.ex...
[ERROR]   
TestHashJoinAdvanced.testHashInnerJoinWithEmptyTable:182->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testHashLeftJoinWithEmptyTable:177->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testHashRightJoinWithEmptyTable:187->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testJoinOrdering:215->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testJoinWithDifferentTypesInCondition:124->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testJoinWithMapAndDotField:172->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testLeftHashJoinWithMap:82->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testLeftSelfHashJoinWithMap:69->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinAdvanced.testRightJoinWithMap:110->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinJPPDPlan.testHashJoinWithFuncJoinCondition:64->PlanTestBase.testPlanWithAttributesMatchingPatterns:148->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestHashJoinJPPDPlan.testLeftHashJoin:48->PlanTestBase.testPlanWithAttributesMatchingPatterns:148->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testHashInnerJoinWithLeftEmptyDirTable:50->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testHashInnerJoinWithRightEmptyDirTable:66->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testHashLeftJoinWithRightEmptyDirTable:98->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testHashRightJoinWithRightEmptyDirTable:114->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testMergeInnerJoinWithBothEmptyDirTables:162->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testMergeInnerJoinWithLeftEmptyDirTable:130->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testMergeInnerJoinWithRightEmptyDirTable:146->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testMergeLeftJoinWithRightEmptyDirTable:178->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testMergeRightJoinWithRightEmptyDirTable:194->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testNestedLoopInnerJoinWithLeftEmptyDirTable:210->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testNestedLoopInnerJoinWithRightEmptyDirTable:226->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testNestedLoopLeftJoinWithLeftEmptyDirTable:260->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testNestedLoopLeftJoinWithRightEmptyDirTable:278->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestJoinEmptyDirTable.testNestedLoopRightJoinWithLeftEmptyDirTable:295->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testDrill4196:264->BaseTestQuery.testRunAndReturn:341 » 
Rpc
[ERROR]   
TestMergeJoinAdvanced.testJoinWithDifferentTypesInCondition:88->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeInnerJoinLargeLeft:181->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeInnerJoinLargeRight:166->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeInnerJoinWithEmptyTable:274->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeLeftJoinLargeLeft:187->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeLeftJoinLargeRight:171->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeLeftJoinWithEmptyTable:269->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeRightJoinLargeLeft:192->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeRightJoinLargeRight:176->testMultipleBatchJoin:161->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinAdvanced.testMergeRightJoinWithEmptyTable:279->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestMergeJoinWithSchemaChanges.testOneSideSchemaChanges:348->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNLJWithEmptyBatch:249->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNestedInnerJoinWithEmptyTable:352->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNestedLeftJoinWithEmptyTable:342->JoinTestBase.testJoinWithEmptyFile:76->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinEqualityNonScalar_1_planning:154->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinEqualityNonScalar_2_planning:169->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinEqualityScalar_1_planning:128->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinInequality_1:96->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinInequality_2:102->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinInequality_3:109->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinNotIn_1_exec:201->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinWithLargeRightInputSuccess:330->PlanTestBase.testPlanMatchingPatterns:84->PlanTestBase.testPlanMatchingPatterns:89->PlanTestBase.getPlanInString:369->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestNestedLoopJoin.testNlJoinWithStringsInCondition:432->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestSemiJoin.testInClauseToSemiJoin:42 » Rpc 
org.apache.drill.common.exception...
[ERROR]   TestSemiJoin.testMultiColumnInClauseWithSemiJoin:114 » Rpc 
org.apache.drill.co...
[ERROR]   TestSemiJoin.testStarWithInClauseToSemiJoin:100 » Rpc 
org.apache.drill.common....
[ERROR]   
TestLateralPlans.testLateralSqlWithAS:191->BaseTestQuery.testRunAndReturn:341 » 
Rpc
[ERROR]   
TestLateralPlans.testMultiUnnestLateralAtSameLevel:210->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestLateralPlans.testSubQuerySql:229->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   
TestLimitWithExchanges.testLimitImpactExchange:124->testLimitHelper:142->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestLimitWithExchanges.testNegPushLimitPastUnionExchange:96->testLimitHelper:142->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestLimitWithExchanges.testPushLimitPastUnionExchange:56->testLimitHelper:142->BaseTestQuery.testSqlWithResults:322->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestCTTAS.testJoinTemporaryWithPersistentTable:446->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   
TestCTTAS.testSelectWithJoinOnTemporaryTables:242->BaseTestQuery.testRunAndReturn:341
 » Rpc
[ERROR]   TestConformance.testApply:47 » Rpc 
org.apache.drill.common.exceptions.UserRemo...
[ERROR]   TestParquetComplex.hashJoin:61->BaseTestQuery.testRunAndReturn:341 » 
Rpc org.a...
[ERROR]   TestParquetComplex.mergeJoin:74->BaseTestQuery.testRunAndReturn:341 » 
Rpc org....
[ERROR]   TestParquetFilterPushdownWithTransitivePredicates.testForSubQuery » 
UserRemote
[ERROR]   
TestParquetFilterPushdownWithTransitivePredicates.testForTransitiveFilterPushPastAgg
 » UserRemote
[ERROR]   
TestComplexTypeReader.test_array:323->BaseTestQuery.testRunAndReturn:341 » Rpc
[ERROR]   TestJsonNanInf.testHashJoinWithNaN:370 »  
org.apache.drill.common.exceptions.U...
[ERROR]   TestJsonNanInf.testMergeJoinWithNaN:401 »  
org.apache.drill.common.exceptions....
[ERROR]   TestJsonNanInf.testNestedLoopJoinWithNaN:340 »  
org.apache.drill.common.except...
[INFO] 
[ERROR] Tests run: 3739, Failures: 3, Errors: 193, Skipped: 153
{noformat}
I have looked into some errors with simple queries, for example, 
{{TestExampleQueries.testJoinExpOn}} test fails because the physical plan 
cannot be obtained.
The logical plan is the same with and without changes:
{noformat}
DrillScreenRel: rowcount = 25.0, cumulative cost = {112.5 rows, 987.5 cpu, 0.0 
io, 0.0 network, 132.0 memory}, id = 180
  DrillProjectRel(n_nationkey=[$0]): rowcount = 25.0, cumulative cost = {110.0 
rows, 985.0 cpu, 0.0 io, 0.0 network, 132.0 memory}, id = 178
    DrillJoinRel(condition=[AND(=($1, $3), =($2, $3))], joinType=[inner]): 
rowcount = 25.0, cumulative cost = {85.0 rows, 960.0 cpu, 0.0 io, 0.0 network, 
132.0 memory}, id = 176
      DrillProjectRel(n_nationkey=[$0], $f3=[+($1, 1)], $f4=[+($1, 1)]): 
rowcount = 25.0, cumulative cost = {50.0 rows, 275.0 cpu, 0.0 io, 0.0 network, 
0.0 memory}, id = 173
        DrillScanRel(table=[[cp, tpch/nation.parquet]], 
groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=classpath:/tpch/nation.parquet]], 
selectionRoot=classpath:/tpch/nation.parquet, numFiles=1, numRowGroups=1, 
usedMetadataFile=false, columns=[`n_nationkey`, `n_regionkey`]]]): rowcount = 
25.0, cumulative cost = {25.0 rows, 50.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, 
id = 124
      DrillScanRel(table=[[cp, tpch/region.parquet]], 
groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=classpath:/tpch/region.parquet]], 
selectionRoot=classpath:/tpch/region.parquet, numFiles=1, numRowGroups=1, 
usedMetadataFile=false, columns=[`r_regionkey`]]]): rowcount = 5.0, cumulative 
cost = {5.0 rows, 5.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 114
{noformat}
But physical plan (which cannot be built) should be the following:
{noformat}
00-00    Screen : rowType = RecordType(ANY n_nationkey): rowcount = 25.0, 
cumulative cost = {137.5 rows, 1012.5 cpu, 55.0 io, 0.0 network, 132.0 memory}, 
id = 992
00-01      Project(n_nationkey=[$0]) : rowType = RecordType(ANY n_nationkey): 
rowcount = 25.0, cumulative cost = {135.0 rows, 1010.0 cpu, 55.0 io, 0.0 
network, 132.0 memory}, id = 991
00-02        Project(n_nationkey=[$0]) : rowType = RecordType(ANY n_nationkey): 
rowcount = 25.0, cumulative cost = {110.0 rows, 985.0 cpu, 55.0 io, 0.0 
network, 132.0 memory}, id = 990
00-03          HashJoin(condition=[AND(=($1, $3), =($2, $3))], 
joinType=[inner], semi-join: =[false]) : rowType = RecordType(ANY n_nationkey, 
ANY $f3, ANY $f4, ANY r_regionkey): rowcount = 25.0, cumulative cost = {85.0 
rows, 960.0 cpu, 55.0 io, 0.0 network, 132.0 memory}, id = 989
00-05            Project(n_nationkey=[$0], $f3=[+($1, 1)], $f4=[+($1, 1)]) : 
rowType = RecordType(ANY n_nationkey, ANY $f3, ANY $f4): rowcount = 25.0, 
cumulative cost = {50.0 rows, 275.0 cpu, 50.0 io, 0.0 network, 0.0 memory}, id 
= 987
00-06              Scan(table=[[cp, tpch/nation.parquet]], 
groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=classpath:/tpch/nation.parquet]], 
selectionRoot=classpath:/tpch/nation.parquet, numFiles=1, numRowGroups=1, 
usedMetadataFile=false, columns=[`n_nationkey`, `n_regionkey`]]]) : rowType = 
RecordType(ANY n_nationkey, ANY n_regionkey): rowcount = 25.0, cumulative cost 
= {25.0 rows, 50.0 cpu, 50.0 io, 0.0 network, 0.0 memory}, id = 986
00-04            Scan(table=[[cp, tpch/region.parquet]], 
groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath 
[path=classpath:/tpch/region.parquet]], 
selectionRoot=classpath:/tpch/region.parquet, numFiles=1, numRowGroups=1, 
usedMetadataFile=false, columns=[`r_regionkey`]]]) : rowType = RecordType(ANY 
r_regionkey): rowcount = 5.0, cumulative cost = {5.0 rows, 5.0 cpu, 5.0 io, 0.0 
network, 0.0 memory}, id = 988
{noformat}

> ProjectMergeRule is infinitely matched when is applied after 
> ProjectReduceExpressionsRule
> -----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2223
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2223
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Volodymyr Vysotskyi
>            Assignee: Julian Hyde
>            Priority: Critical
>         Attachments: heap_overview.png, provenance_contents.png
>
>
> For queries like this:
> {code:sql}
> select t1.f from (select cast(f as int) f, f from (select cast(f as int) f 
> from (values('1')) t(f))) as t1
> {code}
> OOM is thrown when {{ProjectMergeRule}} is applied before applying 
> {{ProjectReduceExpressionsRule}} in VolcanoPlanner.
>  A simple test to reproduce this issue (in {{RelOptRulesTest}}):
> {code:java}
>   @Test public void testOomProjectMergeRule() {
>     RelBuilder relBuilder = 
> RelBuilder.create(RelBuilderTest.config().build());
>     RelNode relNode = relBuilder
>         .values(new String[]{"f"}, "1")
>         .project(
>             relBuilder.alias(
>                 relBuilder.cast(relBuilder.field(0), SqlTypeName.INTEGER),
>                 "f"))
>         .project(
>             relBuilder.alias(
>                 relBuilder.cast(relBuilder.field(0), SqlTypeName.INTEGER),
>                 "f0"),
>             relBuilder.alias(relBuilder.field(0), "f"))
>         .project(
>             relBuilder.alias(relBuilder.field(0), "f"))
>         .build();
>     RelOptPlanner planner = relNode.getCluster().getPlanner();
>     RuleSet ruleSet =
>         RuleSets.ofList(
>             ReduceExpressionsRule.PROJECT_INSTANCE,
>             new ProjectMergeRuleWithLongerName(),
>             EnumerableRules.ENUMERABLE_PROJECT_RULE,
>             EnumerableRules.ENUMERABLE_VALUES_RULE);
>     Program program = Programs.of(ruleSet);
>     RelTraitSet toTraits =
>         relNode.getCluster().traitSet()
>             .replace(0, EnumerableConvention.INSTANCE);
>     RelNode output = program.run(planner, relNode, toTraits,
>         ImmutableList.<RelOptMaterialization>of(), 
> ImmutableList.<RelOptLattice>of());
>     // check for output
>   }
>   /**
>    * ProjectMergeRule inheritor which has
>    * class name greater than ProjectReduceExpressionsRule class name 
> (String.compareTo()).
>    *
>    * It is needed for RuleQueue.popMatch() method
>    * to apply this rule before ProjectReduceExpressionsRule.
>    */
>   private static class ProjectMergeRuleWithLongerName extends 
> ProjectMergeRule {
>     public ProjectMergeRuleWithLongerName() {
>       super(true, RelFactories.LOGICAL_BUILDER);
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to