[ https://issues.apache.org/jira/browse/CALCITE-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15959924#comment-15959924 ]
Maryann Xue edited comment on CALCITE-1742 at 4/6/17 10:51 PM: --------------------------------------------------------------- bq. From the code, schema.addTable is only called when the located TableEntry was not successfully unwrapped into a PreparingTable instance. If that happens, it will replace the old one with a new properly created TableEntry in schema. I don't think calling {{addSchema}} will actually do anything about the {{Table}} instance other than create a new {{TableEntry}} object with exactly the same name and Table objects, i.e. it won't wrap the {{Table}} instance with a {{RelOptTableImpl}} at this point. The side effect of calling {{addSchema}} though, is adding this Table into the {{tableMap}} which is targeted for explicit tables only (sorry I shouldn't have called it cache). Note that the {{Table}} instance here can be an "explicit" or an "implicit" table, so it should NOT be added to the {{tableMap}}. Otherwise if it's an implicit Table, the change of this Table from the underlying {{Schema}} provider object can be shadowed. was (Author: maryannxue): bq. From the code, schema.addTable is only called when the located TableEntry was not successfully unwrapped into a PreparingTable instance. If that happens, it will replace the old one with a new properly created TableEntry in schema. I don't calling {{addSchema}} will actually do anything about the {{Table}} instance other than create a new {{TableEntry}} object with exactly the same name and Table objects. The side effect of calling {{addSchema}} though, is adding this Table into the {{tableMap}} which is targeted for explicit tables only (sorry I shouldn't have called it cache). Note that the {{Table}} instance here can be an "explicit" or an "implicit" table, so it should NOT be added to the {{tableMap}}. Otherwise if it's an implicit Table, the change of this Table from the underlying {{Schema}} provider object can be shadowed. > Avoid caching sub-objects from CalciteSchema if caching is not enabled > ---------------------------------------------------------------------- > > Key: CALCITE-1742 > URL: https://issues.apache.org/jira/browse/CALCITE-1742 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.12.0 > Reporter: Maryann Xue > Assignee: Maryann Xue > > We have two implementations of CalciteSchema, {{CachingCalciteSchema}} and > {{SimpleCalciteSchema}}. There is still caching in the parent class > {{CalciteSchema}}, though, that causes objects to be cached even if caching > is not enabled (as in {{SimpleCalciteSchema}}). -- This message was sent by Atlassian JIRA (v6.3.15#6346)