We did have some hints for our physical rules to apply some strategies, the very common case is the JOIN algorithm, such as the NESTED_LOOP, SHUFFLE_HASH, SORT_MERGE and so on.
The only reason that I do not implement the physical hints for Calcite is that I do not have enough time for that, sorry. Jia Tao, what kind of physical hints do you expect to have for Calcite physical operators ? Best, Danny Chan Julian Hyde <[email protected]> 于2021年5月20日周四 上午1:06写道: > Sure, there’s a slot to hold the hints. But is there a benefit to keeping > them in the physical algebra? There is certainly a cost to storing them, > propagating them, fixing them up as we apply rules. > > The main source of hints is formatted comments in the SQL. As we get > further from the SQL source and the AST, the benefit decreases. > > Danny, > > Were you envisioning hints being propagated into physical algebra? There’s > no explicit mention in > https://docs.google.com/document/d/1mykz-w2t1Yw7CH6NjUWpWqCAf_6YNKxSc59gXafrNCs/edit > < > https://docs.google.com/document/d/1mykz-w2t1Yw7CH6NjUWpWqCAf_6YNKxSc59gXafrNCs/edit> > or https://issues.apache.org/jira/browse/CALCITE-482 < > https://issues.apache.org/jira/browse/CALCITE-482>. > > Julian > > > > On May 18, 2021, at 7:49 PM, JiaTao Tao <[email protected]> wrote: > > > > Hi Julian > > > > When hints were introduced, was that part of the plan? > > > > "hint" is a field in the base class, so the type of the node doesn't > matter > > > > public abstract class Project extends SingleRel implements Hintable { > > //~ Instance fields > -------------------------------------------------------- > > > > protected final ImmutableList<RexNode> exps; > > > > protected final ImmutableList<RelHint> hints; > > > > > > And in RelBuilder#project, we just construct a project without > > hints(ImmutableList.of()), so it will lose hints too. > > > > public RelBuilder project(Iterable<? extends RexNode> nodes, > > Iterable<? extends @Nullable String> fieldNames, boolean force) { > > return project_(nodes, fieldNames, ImmutableList.of(), force); > > } > > > > > > > > Regards! > > > > Aron Tao > > > > > > Julian Hyde <[email protected]> 于2021年5月19日周三 上午12:30写道: > > > >> Do we really need hints in physical operators? When hints were > introduced, > >> was that part of the plan? > >> > >> Julian > >> > >>> On May 17, 2021, at 11:50 PM, JiaTao Tao <[email protected]> wrote: > >>> > >>> Hi > >>> Recently, I'm integrating Calcite's hint into our system, and I've > found > >>> the Enumerable rules just throw the hint info(ImmutableList.of()) away: > >>> > >>> public EnumerableProject( > >>> RelOptCluster cluster, > >>> RelTraitSet traitSet, > >>> RelNode input, > >>> List<? extends RexNode> projects, > >>> RelDataType rowType) { > >>> super(cluster, traitSet, ImmutableList.of(), input, projects, > >> rowType); > >>> assert getConvention() instanceof EnumerableConvention; > >>> } > >>> > >>> > >>> Regards! > >>> > >>> Aron Tao > >> > >
