Hi community, Now I am reading the source code of calcite sql hint,and I
found in SubTreeHintPropagateShuttle class, from the root node, it will be
the most search 3 layers down child nodes, trying to propagate
the original RelNode hints, 3 are fixed. SubTreeHintPropagateShuttle is a
RelShuttle,and its purpose is that when a rule rewrited a RelNode Tree,
need to propagate the original RelNode Hints to rewrite RelNode. More
details could see RelOptUtil# propagateRelHints method. My idea is that
make SubTreeHintPropagateShuttle search child layers could let user
configurable. One way is to add the setHintSearchNum and getHintSearchNum
methods to the RelOptCluster class, and then in the
RelOptUtil#propagateRelHints method, using
originalRel.getCluster().getHintSearchNum
to get the search the number of layers, and then transfer to
SubTreeHintPropagateShuttle.This is just my idea, not the final
implementation. Code links: 1.
https://github.com/apache/calcite/blob/50c3edfc3d6630528ab51fe836bd50df82cc7db8/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L4199C7-L4202C8
2.
https://github.com/apache/calcite/blob/50c3edfc3d6630528ab51fe836bd50df82cc7db8/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L426C2-L435C34

Best,
LakeShen

Reply via email to