doris icon indicating copy to clipboard operation
doris copied to clipboard

[feature-wip](multi-catalog) Support flatten catalog

Open morningman opened this issue 3 years ago • 2 comments

Proposed changes

Issue Number: close #xxx

Problem summary

Doris is now support 3 level schema: Catalog -> Database -> Table

However, when using some MySQL-compatible tools to connect to Doris, these tools only support two-level (Database -> Table) metadata, so the database information in the external catalog cannot be displayed.

This PR attempts to make compatibility improvements to this issue.

In normal use, when users need to switch to other catalogs, they can use the switch statement to switch, such as: switch hms_catalog;

and then use the use statement to switch the database: use db;

At the same time, we can directly use the following commands to directly switch the catalog and database: use __hms_catalog__db;

Here we use __ as a special identifier so that the system can identify and parse out the catalog name. At the same time, we prohibit __ in the catalog name, so as to ensure that there are no semantic errors.

This change does not require any additional configuration, and Doris will automatically perform the correct operation based on the name.

I have tested mysql command line tool and dbeaver, which works fine with this feature.

$ mysql -h 127.0.0.1 -P 9030 -uroot -D__hive__tpch100;
mysql> show tables;
+-------------------+
| Tables_in_tpch100 |
+-------------------+
| customer          |
| lineitem          |
| nation            |
| orders            |
| part              |
| partsupp          |
| region            |
| supplier          |
+-------------------+
8 rows in set (0.00 sec)

The document will be added later with full multi-catalog feature.

Checklist(Required)

  1. Does it affect the original behavior:
    • [x] Yes
    • [ ] No
    • [ ] I don't know
  2. Has unit tests been added:
    • [x] Yes
    • [ ] No
    • [ ] No Need
  3. Has document been added or modified:
    • [ ] Yes
    • [x] No
    • [ ] No Need
  4. Does it need to update dependencies:
    • [ ] Yes
    • [x] No
  5. Are there any changes that cannot be rolled back:
    • [ ] Yes (If Yes, please explain WHY)
    • [x] No

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

morningman avatar Sep 21 '22 04:09 morningman

Show databases can return all database?

stalary avatar Sep 22 '22 01:09 stalary

No, it still only return database in current catalog. I thought about this feature. This feature requires additional config to tell the system whether to return all databasses or not, So I'm hesitant to add this feature.

morningman avatar Sep 22 '22 02:09 morningman

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!

github-actions[bot] avatar Mar 22 '23 00:03 github-actions[bot]