[ https://issues.apache.org/jira/browse/CALCITE-4097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17149058#comment-17149058 ]
Haisheng Yuan commented on CALCITE-4097: ---------------------------------------- I copied from code comment. > Avoid requesting unnecessary trait request when deriving traits from child > inputs > --------------------------------------------------------------------------------- > > Key: CALCITE-4097 > URL: https://issues.apache.org/jira/browse/CALCITE-4097 > Project: Calcite > Issue Type: Improvement > Components: core > Reporter: Haisheng Yuan > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > If the child subset is used to derive new traits for > current relnode, the subset will be marked REQUIRED > when registering the new derived relnode and later > will add enforcers between other delivered subsets. > e.g. a MergeJoin request both inputs hash distributed > by [a,b] sorted by [a,b]. If the left input R1 happens to > be distributed by [a], the MergeJoin can derive new > traits from this input and request both input to be > distributed by [a] sorted by [a,b]. In case there is a > alternative R2 with ANY distribution in the left input's > RelSet, we end up with requesting hash distribution > [a] on alternative R2, which is unnecessary and waste, > because we request distribution by [a] because of R1 can > deliver the exact same distribution and we don't need to > enforce properties on other subsets that can't satisfy > the specific trait requirement. -- This message was sent by Atlassian Jira (v8.3.4#803005)