databend
databend copied to clipboard
feat: add into database trait Table API
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
feat: add into database trait Table API, each table API of catalog MUST
first get a Database
trait.
Fixes https://github.com/datafuselabs/databend/issues/7819
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
Name | Status | Preview | Updated |
---|---|---|---|
databend | ⬜️ Ignored (Inspect) | Sep 26, 2022 at 1:17PM (UTC) |
Can you give some explanation about why getting a
Table
has to be done via aDatabase
?
In order to support share database
query tables.
In API such as catalog.get_table(tenant, db_name, table_name)
, catalog just pass (tenant,db_name,table_name)
to meta, if it is a normal table, it will works fine.
But if (tenant,db_name,table_name)
is a shared table, it may happen that this meta service has no share table meta.
So we need to add table API into Database trait, move all Table API in catalog route to Database trait.
Take the catalog.get_table(tenant, db_name, table_name)
API for example:
- first get Database trait impl(now has only default database impl, but there will be share database impl for Database trait).
- And if found Database is a share database, the share database impl for Database trait will route the table request to the meta which the provider located.
Take the
catalog.get_table(tenant, db_name, table_name)
API for example:
- first get Database trait impl(now has only default database impl, but there will be share database impl for Database trait).
- And if found Database is a share database, the share database impl for Database trait will route the table request to the meta which the provider located.
There are two types related to a database: one is about the data a DB has, i.e., the DatabaseMeta
, and the other is about the behavior a DB provides, i.e., dyn Database
.
To get a table, the catalog
only needs the data part of a DB, not the behavior part.
Binding get-table functions to dyn Database
introduces unnecessary coupling. I am not quite sure it will work.