Discussion moved to https://issues.apache.org/jira/browse/CALCITE-3769 <https://issues.apache.org/jira/browse/CALCITE-3769>. (For the benefit of those reading the archive.)
> On Feb 4, 2020, at 3:25 AM, Danny Chan <[email protected]> wrote: > > The TableScanRule is the only planner rule that for a logical node(e.g. the > table scan), it’s functionality is to pass along the cluster object and > invoke the RelOptTable#toRel. It’s function is very trivial because it > supplies only a ToRelContext that does not support expanding view/passing > table hints. > > For rels that come from the sql-to-rel conversion, there is already a table > conversion logic[1]. This code gives a powerful > ToRelContext that has the complete functionality. > > The only reason that I saw the meaning of existing TableScanRule is for the > TableScan that comes from the RelBuilder#scan. > > So I would suggest to deprecate the TableScanRule, instead, we support > translating the table directly in RelBuilder#scan, > We also add a new interface RelBuilder#scan(Iterable<String> tableNames, > ToRelContext context), so that we can pass in a more powerful ToRelContext > explicitly. > > [1] > https://github.com/apache/calcite/blob/d6fa25cd11625ad7b4b74dafbd0211c701b38d49/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L3498 > > Best, > Danny Chan
