Skip to content

Commit

Permalink
add Doris doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoukangcn committed Apr 19, 2024
1 parent 589ac44 commit 67569be
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 0 deletions.
Binary file added docs/assets/webui/props-doris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/gravitino-server-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ The following table lists the catalog specific properties and their default path
| `lakehouse-iceberg` | [Lakehouse Iceberg catalog properties](lakehouse-iceberg-catalog.md#catalog-properties) | `catalogs/lakehouse-iceberg/conf/lakehouse-iceberg.conf` |
| `jdbc-mysql` | [MySQL catalog properties](jdbc-mysql-catalog.md#catalog-properties) | `catalogs/jdbc-mysql/conf/jdbc-mysql.conf` |
| `jdbc-postgresql` | [PostgreSQL catalog properties](jdbc-postgresql-catalog.md#catalog-properties) | `catalogs/jdbc-postgresql/conf/jdbc-postgresql.conf` |
| `jdbc-doris` | [Doris catalog properties](jdbc-doris-catalog.md#catalog-properties) | `catalogs/jdbc-doris/conf/jdbc-doris.conf` |

:::info
The Gravitino server automatically adds the catalog properties configuration directory to classpath.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Gravitino currently supports the following catalogs:
* [**Hive catalog**](./apache-hive-catalog.md)
* [**MySQL catalog**](./jdbc-mysql-catalog.md)
* [**PostgreSQL catalog**](./jdbc-postgresql-catalog.md)
* [**Doris catalog**](./jdbc-doris-catalog.md)

**Fileset catalogs:**

Expand Down Expand Up @@ -105,6 +106,7 @@ Gravitino supports different catalogs to manage the metadata in different source
* [Hive catalog](./apache-hive-catalog.md): a complete guide to using Gravitino to manage Apache Hive data.
* [MySQL catalog](./jdbc-mysql-catalog.md): a complete guide to using Gravitino to manage MySQL data.
* [PostgreSQL catalog](./jdbc-postgresql-catalog.md): a complete guide to using Gravitino to manage PostgreSQL data.
* [Doris catalog](./jdbc-doris-catalog.md): a complete guide to using Gravitino to manage Doris data.
* [Hadoop catalog](./hadoop-catalog.md): a complete guide to using Gravitino to manage fileset
using Hadoop Compatible File System (HCFS).

Expand Down
173 changes: 173 additions & 0 deletions docs/jdbc-doris-catalog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
title: "Doris catalog"
slug: /jdbc-doris-catalog
keywords:
- jdbc
- Doris
- metadata
license: "Copyright 2024 Datastrato Pvt Ltd.
This software is licensed under the Apache License version 2."
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

## Introduction

Gravitino provides the ability to manage Doris metadata.

:::caution
Gravitino saves some system information in schema and table comment, like `(From Gravitino, DO NOT EDIT: gravitino.v1.uid1078334182909406185)`, please don't change or remove this message.
:::

## Catalog

### Catalog capabilities

- Gravitino catalog corresponds to the Doris instance.
- Supports metadata management of Doris (1.2.x).
- Supports table index.
- Supports [column default value](./manage-relational-metadata-using-gravitino.md#table-column-default-value).

### Catalog properties

You can pass to a Doris data source any property that isn't defined by Gravitino by adding `gravitino.bypass` prefix as a catalog property. For example, catalog property `gravitino.bypass.maxWaitMillis` will pass `maxWaitMillis` to the data source property.

Check the relevant data source configuration in [data source properties](https://commons.apache.org/proper/commons-dbcp/configuration.html)

If you use a Doris catalog, you must provide `jdbc-url`, `jdbc-driver`, `jdbc-user` and `jdbc-password` to catalog properties.

| Configuration item | Description | Default value | Required | Since Version |
|----------------------|-------------------------------------------------------------------------------------|---------------|----------|---------------|
| `jdbc-url` | JDBC URL for connecting to the database. For example, `jdbc:mysql://localhost:9030` | (none) | Yes | 0.5.0 |
| `jdbc-driver` | The driver of the JDBC connection. For example, `com.mysql.jdbc.Driver`. | (none) | Yes | 0.5.0 |
| `jdbc-user` | The JDBC user name. | (none) | Yes | 0.5.0 |
| `jdbc-password` | The JDBC password. | (none) | Yes | 0.5.0 |
| `jdbc.pool.min-size` | The minimum number of connections in the pool. `2` by default. | `2` | No | 0.5.0 |
| `jdbc.pool.max-size` | The maximum number of connections in the pool. `10` by default. | `10` | No | 0.5.0 |

:::caution
You must download the corresponding JDBC driver to the `catalogs/jdbc-doris/libs` directory.
:::

### Catalog operations

Refer to [Manage Relational Metadata Using Gravitino](./manage-relational-metadata-using-gravitino.md#catalog-operations) for more details.

## Schema

### Schema capabilities

- Gravitino's schema concept corresponds to the Doris database.
- Supports creating schema.
- Supports dropping schema.

### Schema properties

- Support schema properties

### Schema operations

Refer to [Manage Relational Metadata Using Gravitino](./manage-relational-metadata-using-gravitino.md#schema-operations) for more details.

## Table

### Table capabilities

- Gravitino's table concept corresponds to the Doris table.
- Supports index.
- Supports [column default value](./manage-relational-metadata-using-gravitino.md#table-column-default-value) and [auto-increment](./manage-relational-metadata-using-gravitino.md#table-column-auto-increment)..

#### Table column types

| Gravitino Type | Doris Type |
|----------------|------------|
| `Boolean` | `Boolean` |
| `Byte` | `TinyInt` |
| `Short` | `SmallInt` |
| `Integer` | `Int` |
| `Long` | `BigInt` |
| `Float` | `Float` |
| `Double` | `Double` |
| `Decimal` | `Decimal` |
| `Date` | `Date` |
| `Timestamp` | `Datetime` |
| `VarChar` | `VarChar` |
| `FixedChar` | `Char` |
| `String` | `String` |

:::info
MySQL doesn't support Gravitino `Fixed` `Struct` `List` `Map` `Timestamp_tz` `IntervalDay` `IntervalYear` `Union` `UUID` type.
Meanwhile, the data types other than listed above are mapped to Gravitino **[Unparsed Type](./manage-relational-metadata-using-gravitino.md#unparsed-type)** that represents an unresolvable data type since 0.5.0.
:::

#### Table column auto-increment

:::note
Doris does not support auto-increment column before version 2.1.0
So, Gravitino did not support auto-increment column before version 0.5.0
:::


### Table properties

Doris supports table properties, and you can set them in the table properties.

### Table indexes

- Supports PRIMARY_KEY

:::note
Index can only apply to a single column
:::

<Tabs>
<TabItem value="json" label="Json">

```json
{
"indexes": [
{
"indexType": "primary_key",
"name": "PRIMARY",
"fieldNames": [["id"]]
}
]
}
```

</TabItem>
<TabItem value="java" label="Java">

```java
Index[] indexes = new Index[] {
Indexes.of(IndexType.PRIMARY_KEY, "PRIMARY", new String[][]{{"id"}})
}
```

</TabItem>
</Tabs>

### Table operations

Refer to [Manage Relational Metadata Using Gravitino](./manage-relational-metadata-using-gravitino.md#table-operations) for more details.

#### Alter table operations

Gravitino supports these table alteration operations:

- `RenameTable`
- `UpdateComment`
- `AddColumn`
- `DeleteColumn`
- `UpdateColumnType`
- `UpdateColumnPosition`
- `UpdateColumnComment`
- `SetProperty`

:::info
- Not all table alteration operations can be processed in batch.
- Schema change, such as add/modify/drop columns can be processed in batch
- Can modify multi column comments at same time
- You can't modify the column type and column comment at the same time
:::
4 changes: 4 additions & 0 deletions docs/manage-relational-metadata-using-gravitino.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For more details, please refer to the related doc.
- [**Apache Hive**](./apache-hive-catalog.md)
- [**MySQL**](./jdbc-mysql-catalog.md)
- [**PostgreSQL**](./jdbc-postgresql-catalog.md)
- [**Doris**](./jdbc-doris-catalog.md)
- [**Apache Iceberg**](./lakehouse-iceberg-catalog.md)

Assuming:
Expand Down Expand Up @@ -93,6 +94,7 @@ Currently, Gravitino supports the following catalog providers:
| `lakehouse-iceberg` | [Iceberg catalog property](./lakehouse-iceberg-catalog.md#catalog-properties) |
| `jdbc-mysql` | [MySQL catalog property](./jdbc-mysql-catalog.md#catalog-properties) |
| `jdbc-postgresql` | [PostgreSQL catalog property](./jdbc-postgresql-catalog.md#catalog-properties) |
| `jdbc-doris` | [Doris catalog property](./jdbc-doris-catalog.md#catalog-properties) |

### Load a catalog

Expand Down Expand Up @@ -305,6 +307,7 @@ Currently, Gravitino supports the following schema property:
| `lakehouse-iceberg` | [Iceberg scheme property](./lakehouse-iceberg-catalog.md#schema-properties) |
| `jdbc-mysql` | [MySQL schema property](./jdbc-mysql-catalog.md#schema-properties) |
| `jdbc-postgresql` | [PostgreSQL schema property](./jdbc-postgresql-catalog.md#schema-properties) |
| `jdbc-doris` | [Doris schema property](./jdbc-doris-catalog.md#schema-properties) |

### Load a schema

Expand Down Expand Up @@ -727,6 +730,7 @@ The following is the table property that Gravitino supports:
| `lakehouse-iceberg` | [Iceberg table property](./lakehouse-iceberg-catalog.md#table-properties) | [Iceberg type mapping](./lakehouse-iceberg-catalog.md#table-column-types) |
| `jdbc-mysql` | [MySQL table property](./jdbc-mysql-catalog.md#table-properties) | [MySQL type mapping](./jdbc-mysql-catalog.md#table-column-types) |
| `jdbc-postgresql` | [PostgreSQL table property](./jdbc-postgresql-catalog.md#table-properties) | [PostgreSQL type mapping](./jdbc-postgresql-catalog.md#table-column-types) |
| `doris` | [Doris table property](./jdbc-doris-catalog.md#table-properties) | [Doris type mapping](./jdbc-doris-catalog.md#table-column-types) |

#### Table partitioning, bucketing, sort ordering and indexes

Expand Down
13 changes: 13 additions & 0 deletions docs/webui.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,19 @@ Creating a catalog requires these fields:
|jdbc-password|The JDBC password |
|jdbc-database|e.g. `pg_database` |

</TabItem>
<TabItem value='doris' label='Doris'>
Follow the [JDBC Doris catalog](jdbc-doris-catalog) document

<Image img={require('./assets/webui/props-doris.png')} style={{ width: 480 }} />

|Key |Description |
|-------------|-----------------------------------------------------|
|jdbc-driver |e.g. `com.mysql.jdbc.Driver` |
|jdbc-url |e.g. `jdbc:mysql://localhost:9030` |
|jdbc-user |The JDBC user name |
|jdbc-password|The JDBC password |

</TabItem>
</Tabs>

Expand Down

0 comments on commit 67569be

Please sign in to comment.