[
https://issues.apache.org/jira/browse/CALCITE-5068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17514220#comment-17514220
]
Julian Hyde commented on CALCITE-5068:
--------------------------------------
What do you mean "the catalog is empty"? Do you mean {{getCatalogs}} returns 0
rows? Do you mean the {{TABLE_CATALOG}} field of {{getSchemas}} is the empty
string? Or null?
Our goal is that {{getSchemas}} is consistent with the JDBC spec,
[DatabaseMetaData.getSchemas|https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getSchemas--].
> There are some problems with the use of catalog
> -----------------------------------------------
>
> Key: CALCITE-5068
> URL: https://issues.apache.org/jira/browse/CALCITE-5068
> Project: Calcite
> Issue Type: Bug
> Reporter: itxiangkui
> Priority: Major
>
> when i use under sqlline
> ````shell
> !schema
> !tables
> !metadata getSchemas
> ````
> When I wait for the command, I find that the catalog seems to be a wrong meta
> information, and it is always empty, even after I call
> connection.setCatalog().
> Looking at the source code, found org.apache.calcite.jdbc.CalciteMetaImpl's
>
> ```java
> Enumerable<MetaSchema> schemas(final String catalog) {
> return Linq4j.asEnumerable(
> getConnection().rootSchema.getSubSchemaMap().values())
> .select((Function1<CalciteSchema, MetaSchema>) calciteSchema ->
> new CalciteMetaSchema(calciteSchema, catalog,
> calciteSchema.getName()))
> .orderBy((Function1<MetaSchema, Comparable>) metaSchema ->
> (Comparable) FlatLists.of(Util.first(metaSchema.tableCatalog, ""),
> metaSchema.tableSchem));
> }
> ```
> Obviously, the parameters of the catalog are not used for filtering, and
> there is no context information of the catalog in the rootSchema. The catalog
> is directly passed to the CalciteMetaSchema object.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)