itxiangkui created CALCITE-5068:
-----------------------------------

             Summary: 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


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)

Reply via email to