[ 
https://issues.apache.org/jira/browse/CALCITE-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17031552#comment-17031552
 ] 

Danny Chen commented on CALCITE-3769:
-------------------------------------

I have tried to do these things:

* Remove the usage of TableScanRule, instead we invoke the RelOptTable#toRel as 
default in TableScanFactoryImpl
* Then i fould that, the RelOptTableImpl#toRel would convert the table directly 
to a physical one EnumerableTableScan, which i think it's tricky and 
weird(wrong behavior), so i try to move the EnumerableTableScan conversion 
logic to EnumerableTableScanRule
* Then i found that our Prepare default rule set would always convert a 
TableScan to BindableTableScan, the reason is not every table scan implement 
the Enumerable convention directly, the BindableTable did(see the JbdcTest). I 
tried to tweak the rule set but i found that many tests would need a change too
* Okey let's keep the rule set as it is, but the JbdcTest fails for the plan 
change because table scan all changes to bindables, just because i remove the 
EnumerableTableScan conversion from RelOptTableImpl#toRel

> Remove ToRelContextFactory
> --------------------------
>
>                 Key: CALCITE-3769
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3769
>             Project: Calcite
>          Issue Type: Wish
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: Danny Chen
>            Assignee: Danny Chen
>            Priority: Major
>             Fix For: 1.22.0
>
>
> The TableScanRule is the only planner rule that for a logical node(e.g. the 
> table scan), its function is to pass along the cluster object and invoke the 
> RelOptTable#toRel which is very trivial because it supplies only a simple 
> 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 more 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 user 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to