[ 
https://issues.apache.org/jira/browse/CALCITE-5991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

asdfgh19 updated CALCITE-5991:
------------------------------
    Attachment:     (was: image-2023-09-10-15-44-42-472.png)

> Reduce the number of tasks related to AbstractConverter in TopDownRuleDriver
> ----------------------------------------------------------------------------
>
>                 Key: CALCITE-5991
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5991
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: asdfgh19
>            Assignee: asdfgh19
>            Priority: Minor
>
> When executing the ensureRootConverters method, we add AbstractConverter to 
> the root Relset.
> In the OptimizeGroup task.
> When the TraitSet of AbstractConverter does not satisfy group, we try 
> passThrough. Since AbstractConverter is not a PhysicalNode instance, 
> passThrough returns null, and then we try Apply ConverterRule for this 
> AbstractConverter. This process can be simplified.
> When the TraitSet of AbstractConverter satisfies group, we perform three 
> tasks: DeriveTrait, CheckInput, and OptimizeGroup. DeriveTrait can be 
> simplified to ApplyRules because derive is invalid because AbstractConverter 
> is not an instance of PhysicalNode.
> And I think CheckInput can be removed in this scenario, because when a Relset 
> merge occurs, when the root Relset merges to the other Relset, the 
> OptimizeGroup will be re-executed from the root Relset. At this time, the 
> equivalent Relsubset of the original child node of the AbstractConverter 
> caused by the Relset merge OptimizeGroup will also be executed, so there is 
> no need to use CheckInput to trigger the OptimizeGroup task of 
> AbstractConverter's new input Relsubset.
> The following is the total number of tasks performed by each test case in 
> TopDownOptTest before and after optimization.
>  
> |TopDownOptTest|before|after|before - after|
> |testValuesTraitRequest|103|88|15|
> |testValuesTraitRequestNeg|99|84|15|
> |testSortAgg|193|187|6|
> |testSortAggPartialKey|322|312|10|
> |testSortMergeJoin|168|153|15|
> |testSortMergeJoinSubsetKey|177|162|15|
> |testSortMergeJoinSubsetKey2|177|162|15|
> |testSortMergeJoinSupersetKey|168|153|15|
> |testSortMergeJoinRight|160|145|15|
> |testSortMergeJoinRightSubsetKey|160|145|15|
> |testSortMergeJoinRightSubsetKey2|160|145|15|
> |testSortMergeJoinRightSupersetKey|160|145|15|
> |testMergeJoinDeriveLeft1|213|205|8|
> |testMergeJoinDeriveLeft2|235|227|8|
> |testMergeJoinDeriveRight1|218|210|8|
> |testMergeJoinDeriveRight2|267|259|8|
> |testCorrelateInnerJoinDeriveLeft|195|180|15|
> |testCorrelateInnerJoinNoDerive|178|163|15|
> |testCorrelateLeftJoinDeriveLeft|195|180|15|
> |testCorrelateLeftJoinNoDerive|178|163|15|
> |testCorrelateSemiJoinDeriveLeft|411|401|10|
> |testSortProject|108|98|10|
> |testSortProjectOnRexCall|91|81|10|
> |testSortProjectWhenCastLeadingToMonotonic|114|108|6|
> |testSortProjectWhenCastLeadingToNonMonotonic|97|91|6|
> |testSortProjectDeriveWhenCastLeadingToMonotonic|373|370|3|
> |testSortProjectDeriveOnRexCall|236|228|8|
> |testSortProjectDeriveWhenCastLeadingToNonMonotonic|237|234|3|
> |testSortProjectDerive3|202|199|3|
> |testSortProjectDerive4|148|145|3|
> |testSortProjectDerive5|278|262|16|
> |testSortProjectDerive|296|288|8|
> |testSortProjectDerive2|233|227|6|
> |testSortProjectDerive6|243|227|16|
> |testSortFilter|311|296|15|
> |testSortFilterDerive|521|508|13|
> |testHashJoinFullOuterJoinNotPushDownSort|139|124|15|
> |testHashJoinLeftOuterJoinPushDownSort|201|186|15|
> |testHashJoinLeftOuterJoinPushDownSort2|195|186|9|
> |testHashJoinInnerJoinPushDownSort|201|186|15|
> |testHashJoinRightOuterJoinPushDownSort|166|151|15|
> |testNestedLoopJoinLeftOuterJoinPushDownSort|195|186|9|
> |testNestedLoopJoinLeftOuterJoinPushDownSort2|195|186|9|
> |testNestedLoopJoinLeftOuterJoinSortKeyOnRightInput|160|151|9|
> |testNestedLoopJoinRightOuterJoinSortPushDown|155|145|10|
> |testHashJoinTraitDerivation|264|248|16|
> |testHashJoinTraitDerivation2|254|238|16|
> |testHashJoinTraitDerivationNegativeCase|294|278|16|
> |testNestedLoopJoinTraitDerivation|264|248|16|
> |testNestedLoopJoinTraitDerivation2|254|238|16|
> |testNestedLoopJoinTraitDerivationNegativeCase|294|278|16|
> |testSortCalc|124|114|10|
> |testSortCalcOnRexCall|107|97|10|
> |testSortCalcWhenCastLeadingToMonotonic|131|125|6|
> |testSortCalcWhenCastLeadingToNonMonotonic|114|108|6|
> |testSortCalcWithFilter|348|333|15|
> |testSortCalcDerive1|323|315|8|
> |testSortCalcDerive2|269|263|6|
> |testSortCalcDerive3|233|230|3|
> |testBatchNestedLoopJoinLeftOuterJoinPushDownSort|206|197|9|
> |testBatchNestedLoopJoinTraitDerivation|275|259|16|



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to