You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2022/04/01 20:16:00 UTC

[jira] [Commented] (CALCITE-5071) Schema.getTableMap cannot handle tables with the same name in "Schema->SubSchema->Table" mode

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

Julian Hyde commented on CALCITE-5071:
--------------------------------------

I agree with [~zabetak]. {{Schema.getTableMap}} is only supposed to contain tables that are DIRECT descendants of that schema, and their names are unique (modulo case-sensitivity), so there's no problem putting them in a map.

In order to find both direct and indirect descendants (e.g. all tables named 'FOO' in all sub-schemas and sub-sub-schemas) then you would need to do a tree-walk. The result may contain several tables named 'FOO', but each would have a unique path (e.g. '/schema1/subSchema2/subSubSchema3/FOO'). If it's not clear, there's a strong correspondence with how file systems work.

> Schema.getTableMap cannot handle tables with the same name in "Schema->SubSchema->Table" mode
> ---------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5071
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5071
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: itxiangkui
>            Priority: Major
>
> When I define catalog(schema) -> database(subschema) -> table three-level warehouse management mode, RootSchema is defined as Catalog, the example is as follows:
> - es
>     -- db1
>        --- table1
> - mysql
>     -- db2
>        --- table1
> When I use the !tables command under Sqlline, that will trigger the call
> getTableMap()
> RootSchema.getTableNames()
> RootSchema.getTable(String name)
> three methods,
> I extended RootSchema.getTableMap() and found that table1 with the same name will appear, then the !tables result set can only display one of the table items
> Can we consider getTableMap() to return Guava Multimap and similar data structures....



--
This message was sent by Atlassian Jira
(v8.20.1#820001)