Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Also, the user-side http connection service can be extended based on this interface in next stage.

3-Qualifier

The qualified names in SQL is divided into three categories:

  1. Column: Column name. Fully qualified name: db.table.column
  2. Table: Table name. Fully qualified name: db.table
  3. UDF: user define function, the UDF belongs to a certain db, so the fully qualified name is db.function()

After adding the datasource level, all qualified names need to add a extra level.
For Tables and UDFs, adding one level does not create semantic ambiguity:

  • A.B.C: ds.db.tbl/func
  • B.C: db.tbl/func
  • C: tbl/func

For Column, because we will support nested types in the future, and fieds of nested types are still connected using DOT. Then there may be ambiguity here, give an example.
Column col: Struct type Col <M1, M2>
Then it might be written as follows:

  • ds.db.tbl.col.m1
  • db.tbl.col
  • tbl.col.m1

You can see that the second and third formats are the same, but the content user want to express is different. So we need a priority-based qualified name resolution rule.

3 parts or less: Match from right to left. This approach ensures forward compatibility. After the datasource level is added, the user does not need to change the original SQL statement.

Example:

  • A.B.C: (d.t.c)->(t.c.f1)→(c.f1.f2)
  • A.B: (t.c)→(c.f1)
  • C: (c)

4 parts or more: Match from left to right.

Example:

  • A.B.C.D: (c.f1.f2.f3)->(t.c.f1.f2)->(d.t.c.f1)→(ds.d.t.c)
  • A.B.C.D.E: (c.f1.f2.f3.f4)->(t.c.f1.f2.f3)->(d.t.c.f1.f2)→(ds.d.t.c.f1)

The modification of the qualified name should only affect the SQL query, because we want to support data federation query between multiple datasources.

But for other functions, we can temporarily not support cross-datasource operations, such as DDL and DML.

In this way, in order not to affect the original syntax, we need to add an additional syntax similar to `use db`, first set the datasource to which the current session belongs, and then all non-query operations are completed within this datasource:

`switch datasource`

4-Privilege

The current Doris privilege management refers to the hierarchical design of mysql, with only has 3 level(global, database and table). Here we need to add a new level for data source.

5-Forward Compatibility

This solution needs to ensure that the original cluster can be upgraded normally.
First, after the old cluster is upgraded, all existing databases in the original cluster will be included under the default internal datasource. This ensures that the original function is completely unchanged. New datasources are created through the new create datasource syntax.

6-Information_schema

information_schema remains unique across the cluster. Because the datasource level is already included in the information_schema, multiple datasources can be stored through the information_schema.Qulifier

Detailed Design

the detailed design of the function.

...