World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#847] improvement(docs): Add Trino connector docs (#1059)
Yuhui0e0ad0998316
diff --git a/docs/gravitino-server-config.md b/docs/gravitino-server-config.mdindex b1db7a9f67..345946b984 100644--- a/docs/gravitino-server-config.md+++ b/docs/gravitino-server-config.md@@ -10,7 +10,7 @@ This software is licensed under the Apache License version 2."## IntroductionGravitino supports several configurations:-1. **Gravitino server configuration**: Used to start up Gravition server.+1. **Gravitino server configuration**: Used to start up Gravitino server.2. **Gravitino catalog properties configuration**: Used to make default values for different catalogs.3. **Some other configurations**: Includes configurations such as HDFS configuration.@@ -96,7 +96,7 @@ These rules only apply on the catalog properties, doesn't affect on the schema o| `jdbc-postgresql` | [PostgresSQL catalog properties](jdbc-postgresql-catalog#catalog-properties) | `catalogs/jdbc-postgresql/conf/jdbc-postgresql.conf` |:::info-Gravition server automatically add catalog properties configuration dir to classpath.+Gravitino server automatically add catalog properties configuration dir to classpath.:::## Some other configurationsdiff --git a/docs/how-to-build.md b/docs/how-to-build.mdindex 0dc86d294f..51768a305d 100644--- a/docs/how-to-build.md+++ b/docs/how-to-build.md@@ -26,7 +26,7 @@ This software is licensed under the Apache License version 2."+ Make sure you have installed Docker in your environment as Gravitino uses it to run integration tests; without it, some Docker-related tests may not run.+ macOS uses "docker-connector" to make the Gravitino Trino connector work with Docker- for macOS. For the details of "docker-connector", please see [docker-connector](https://github.com/wenjunxiao/mac-docker-connector) and [README](../dev/docker/tools/README.md).+ for macOS. For the details of "docker-connector", please see [docker-connector](https://github.com/wenjunxiao/mac-docker-connector) and [README](../dev/docker/tools/README).Alternatively, you can use OrbStack to replace Docker for macOS, please see[OrbStack](https://orbstack.dev/), with OrbStack you can run Gravitino integration testswithout needing to install "docker-connector".diff --git a/docs/how-to-test.md b/docs/how-to-test.mdindex 077c391048..5428a5ffbd 100644--- a/docs/how-to-test.md+++ b/docs/how-to-test.md@@ -95,7 +95,7 @@ public class CatalogHiveIT extends AbstractIT {:::note* You should make sure that the `Docker server` is running before running all theintegration tests. Otherwise, it only runs the integration tests without the `gravitino-docker-it` tag.-* on macOS, please be sure to run the `${GRAVITION_HOME}/dev/docker/tools/mac-docker-connector.sh`+* on macOS, please be sure to run the `${GRAVITINO_HOME}/dev/docker/tools/mac-docker-connector.sh`script before running the integration tests. Or, you should make sure that[OrbStack](https://orbstack.dev/) is running.:::diff --git a/docs/how-to-use-the-playground.md b/docs/how-to-use-the-playground.mdindex 64c0820521..c7f92016d4 100644--- a/docs/how-to-use-the-playground.md+++ b/docs/how-to-use-the-playground.md@@ -8,7 +8,7 @@ This software is licensed under the Apache License version 2."## Playground introduction-Playground is a complete Gravitino Docker runtime environment with `Hive`, `Hdfs`, `Trino`, `MySQL`, `PostgreSQL`, and `Gravitno` server.+Playground is a complete Gravitino Docker runtime environment with `Hive`, `Hdfs`, `Trino`, `MySQL`, `PostgreSQL`, and `Gravitino` server.Depending on your network, the startup may take 3-5 minutes.diff --git a/docs/trino-connector/catalog-hive.md b/docs/trino-connector/catalog-hive.mdnew file mode 100644index 0000000000..e91b718ac2--- /dev/null+++ b/docs/trino-connector/catalog-hive.md@@ -0,0 +1,247 @@+---+title: "Gravitino connector - Hive catalog"+slug: /trino-connector/catalog-hive+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++The Hive catalog allows Trino querying data stored in an Apache Hive data warehouse.++## Requirements++The Hive connector requires a Hive metastore service (HMS), or a compatible implementation of the Hive metastore, such+as AWS Glue.++Apache Hadoop HDFS 2.x supported.++Many distributed storage systems including HDFS, Amazon S3 or S3-compatible systems,+Google Cloud Storage, Azure Storage, and IBM Cloud Object Storage can be queried with the Hive connector.++The coordinator and all workers must have network access to the Hive metastore and the storage system.++Hive metastore access with the Thrift protocol defaults to using port 9083.++Data files must be in a supported file format. Some file formats can be configured using file format configuration+properties+per catalog:++- ORC+- Parquet+- Avro+- RCText (RCFile using ColumnarSerDe)+- RCBinary (RCFile using LazyBinaryColumnarSerDe)+- SequenceFile+- JSON (using org.apache.hive.hcatalog.data.JsonSerDe)+- CSV (using org.apache.hadoop.hive.serde2.OpenCSVSerde)+- TextFile++## Create table++The Gravitino connector currently supports basic Hive table creation statements, such as defining fields,+allowing null values, and adding comments.+However, it does not support advanced features like partitioning, sorting, and distribution.++The Gravitino connector does not support `CREATE TABLE AS SELECT`.++## Alter table++Support for the following alter table operations:++- Rename table+- Add a column+- Drop a column+- Rename a column+- Change a column type+- Set a table property++## Select++The Gravitino connector supports most SELECT statements, allowing the execution of queries successfully.+Currently, it doesn't support certain query optimizations, such as pushdown and pruning functionalities.++## Table properties++You can set additional properties for tables and schemas in the Hive catalog using "WITH" keyword in the "CREATE TABLE"+statement.++```sql+CREATE TABLE "metalake.catalog".dbname.tabname+(+ name varchar,+ salary int+) WITH (+ format = 'TEXTFILE'+);+```++| Property | Description | Default Value | Required | Since Version |+|---------------|-----------------------------------------|------------------------------------------------------------|----------|---------------|+| format | Hive storage format for the table | TEXTFILE | No | 0.2.0 |+| total_size | Total size of the table | (none) | No | 0.2.0 |+| num_files | Number of files | 0 | No | 0.2.0 |+| external | Indicate whether it's an external table | (none) | No | 0.2.0 |+| location | HDFS location for table storage | (none) | No | 0.2.0 |+| table_type | The type of Hive table | (none) | No | 0.2.0 |+| input_format | The input format class for the table | org.apache.hadoop.mapred.TextInputFormat | No | 0.2.0 |+| output_format | The output format class for the table | org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat | No | 0.2.0 |+| serde_lib | The serde library class for the table | org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe | No | 0.2.0 |+| serde_name | Name of the serde | table name by default | No | 0.2.0 |++## Schema properties++| Property | Description | Default Value | Required | Since Version |+|----------|---------------------------------|---------------|----------|---------------|+| location | HDFS location for table storage | (none) | No | 0.2.0 |++## Basic usage examples++First, you need to create a metalake and catalog in Gravitino.+For example, create a new metalake named `test` and create a new catalog named `hive_test` using the `hive` provider.+And configure the Metalake `test` into the `Graviton connector`.+For More information about the Hive catalog, please refer to [Hive catalog](../apache-hive-catalog).++```bash+curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "test",+ "comment": "comment",+ "properties": {}+}' http://gravitino-host:8090/api/metalakes++curl -X POST \+-H "Content-Type: application/json" \+-d '{+ "name": "hive_test",+ "type": "RELATIONAL",+ "comment": "comment",+ "provider": "hive",+ "properties": {+ "metastore.uris": "thrift://hive-host:9083"+ }+}' http://gravitino-host:8090/api/metalakes/test/catalogs+```++Listing all Gravitino managed catalogs:++```sql+SHOW CATALOGS;+```++The results are similar to:++```text+ Catalog+----------------+ gravitino+ jmx+ system+ test.hive_test+(4 rows)++Query 20231017_082503_00018_6nt3n, FINISHED, 1 node+```++The `gravitino` catalog is a catalog defined By Trino catalog configuration.+The `test.hive_test` catalog is the catalog created by you in Gravitino.+Other catalogs are regular user-configured Trino catalogs.++### Creating tables and schemas++Create a new schema named `database_01` in `test.hive_test` catalog.++```sql+CREATE SCHEMA "test.hive_test".database_01;+```++Create a new schema using HDFS location:++```sql+CREATE SCHEMA "test.hive_test".database_01 WITH (+ location = 'hdfs://hdfs-host:9000/user/hive/warehouse/database_01'+);+```++Create a new table named `table_01` in schema `"test.hive_test".database_01` and stored in a TEXTFILE format.++```sql+CREATE TABLE "test.hive_test".database_01.table_01+(+name varchar,+salary int+)+WITH (+ format = 'TEXTFILE'+);+```++### Writing data++Insert data into the table `table_01`:++```sql+INSERT INTO "test.hive_test".database_01.table_01 (name, salary) VALUES ('ice', 12);+```++Insert data into the table `table_01` from select:++```sql+INSERT INTO "test.hive_test".database_01.table_01 (name, salary) SELECT * FROM "test.hive_test".database_01.table_01;+```++### Querying data++Query the `table_01` table:++```sql+SELECT * FROM "test.hive_test".database_01.table_01;+```++### Modify a table++Add a new column `age` to the `table_01` table:++```sql+ALTER TABLE "test.hive_test".database_01.table_01 ADD COLUMN age int;+```++Drop a column `age` from the `table_01` table:++```sql+ALTER TABLE "test.hive_test".database_01.table_01 DROP COLUMN age;+```++Rename the `table_01` table to `table_02`:++```sql+ALTER TABLE "test.hive_test".database_01.table_01 RENAME TO "test.hive_test".database_01.table_02;+```++### DROP++Drop a schema:++```sql+DROP SCHEMA "test.hive_test".database_01;+```++Drop a table:++```sql+DROP TABLE "test.hive_test".database_01.table_01;+```++## HDFS config and permissions++For basic setups, Gravitino connector configures the HDFS client automatically and does not require any configuration+files.+Gravitino connector is not support user to config the `hdfs-site.xml` and `core-site.xml` files to the HDFS client.++Before running any `Insert` statements for Hive tables in Trino,+you must check that the user Trino is using to access HDFS has access to the Hive warehouse directory.+You can override this username by setting the HADOOP_USER_NAME system property in the Trino JVM config,+replacing hdfs_user with the appropriate username:++```text+-DHADOOP_USER_NAME=hdfs_user+```\ No newline at end of filediff --git a/docs/trino-connector/catalog-iceberg.md b/docs/trino-connector/catalog-iceberg.mdnew file mode 100644index 0000000000..0c10ae0378--- /dev/null+++ b/docs/trino-connector/catalog-iceberg.md@@ -0,0 +1,185 @@+---+title: "Gravitino connector - Iceberg catalog"+slug: /trino-connector/catalog-iceberg+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++Apache Iceberg is an open table format for huge analytic datasets.+The Iceberg catalog allows Trino querying data stored in files written in Iceberg format,+as defined in the Iceberg Table Spec. The catalog supports Apache Iceberg table spec versions 1 and 2.++## Requirements++To use Iceberg, you need:+- Network access from the Trino coordinator and workers to the distributed object storage.+- Access to a Hive metastore service (HMS), an AWS Glue catalog, a JDBC catalog, a REST catalog, or a Nessie server.+- Data files stored in a supported file format. These can be configured using file format configuration properties per catalog:+ - ORC+ - Parquet (default)++## Create table++The Gravitino connector currently supports basic Iceberg table creation statements, such as defining fields,+allowing null values, and adding comments.+However, it does not support advanced features like partitioning, sorting, and distribution.++The Gravitino connector does not support `CREATE TABLE AS SELECT`.++## Alter table++Support for the following alter table operations:+- Rename table+- Add a column+- Drop a column+- Rename a column+- Change a column type+- Set a table property++## Select++The Gravitino connector supports most SELECT statements, allowing the execution of queries successfully.+Currently, it doesn't support certain query optimizations, such as pushdown and pruning functionalities.++## Table and Schema properties++Iceberg's tables and schemas do not support properties.++## Basic usage examples++First, you need to create a metalake and catalog in Gravitino.+For example, create a new metalake named `test` and create a new catalog named `iceberg_test` using the `lakehouse-iceberg` provider.+And configure the Metalake `test` into the `Graviton connector`.+For More information about the Iceberg catalog, please refer to [Iceberg catalog](../lakehouse-iceberg-catalog).++```bash+curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "test",+ "comment": "comment",+ "properties": {}+}' http://gravitino-host:8090/api/metalakes++curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "iceberg_test",+ "type": "RELATIONAL",+ "comment": "comment",+ "provider": "lakehouse-iceberg",+ "properties": {+ "uri": "thrift://hive-host:9083",+ "catalog-backend": "hive",+ "warehouse": "hdfs://hdfs-host:9000/user/iceberg/warehouse"+ }+}' http://gravitino-host:8090/api/metalakes/test/catalogs+```++Listing all Gravitino managed catalogs:++```sql+SHOW CATALOGS;+```++The results are similar to:++```text+ Catalog+----------------+ gravitino+ jmx+ system+ test.iceberg_test+(4 rows)++Query 20231017_082503_00018_6nt3n, FINISHED, 1 node+```++The `gravitino` catalog is a catalog defined By Trino catalog configuration.+The `test.iceberg_test` catalog is the catalog created by you in Gravitino.+Other catalogs are regular user-configured Trino catalogs.++### Creating tables and schemas++Create a new schema named `database_01` in `test.iceberg_test` catalog.++```sql+CREATE SCHEMA "test.iceberg_test".database_01;+```++Create a new table named `table_01` in schema `"test.iceberg_test".database_01`.++```sql+CREATE TABLE "test.iceberg_test".database_01.table_01+(+name varchar,+salary int+);+```++### Writing data++Insert data into the table `table_01`:++```sql+INSERT INTO "test.iceberg_test".database_01.table_01 (name, salary) VALUES ('ice', 12);+```++Insert data into the table `table_01` from select:++```sql+INSERT INTO "test.iceberg_test".database_01.table_01 (name, salary) SELECT * FROM "test.iceberg_test".database_01.table_01;+```++### Querying data++Query the `table_01` table:++```sql+SELECT * FROM "test.iceberg_test".database_01.table_01;+```++### Modify a table++Add a new column `age` to the `table_01` table:++```sql+ALTER TABLE "test.iceberg_test".database_01.table_01 ADD COLUMN age int;+```++Drop a column `age` from the `table_01` table:++```sql+ALTER TABLE "test.iceberg_test".database_01.table_01 DROP COLUMN age;+```++Rename the `table_01` table to `table_02`:++```sql+ALTER TABLE "test.iceberg_test".database_01.table_01 RENAME TO "test.iceberg_test".database_01.table_02;+```++### Drop++Drop a schema:++```sql+DROP SCHEMA "test.iceberg_test".database_01;+```++Drop a table:++```sql+DROP TABLE "test.iceberg_test".database_01.table_01;+```++## HDFS username and permissions++Before running any `Insert` statements for Iceberg tables in Trino,+you must check that the user Trino is using to access HDFS has access to the warehouse directory.+You can override this username by setting the HADOOP_USER_NAME system property in the Trino JVM config,+replacing hdfs_user with the appropriate username:++```text+-DHADOOP_USER_NAME=hdfs_user+```\ No newline at end of filediff --git a/docs/trino-connector/catalog-mysql.md b/docs/trino-connector/catalog-mysql.mdnew file mode 100644index 0000000000..bbef7ee76a--- /dev/null+++ b/docs/trino-connector/catalog-mysql.md@@ -0,0 +1,169 @@+---+title: "Gravitino connector - MySQL catalog"+slug: /trino-connector/catalog-mysql+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++The MySQL catalog allows querying and creating tables in an external MySQL instance.+You can join data between different systems like MySQL and Hive, or between two different MySQL instances by this.++## Requirements++To connect to MySQL, you need:+- MySQL 5.7, 8.0 or higher.+- Network access from the Trino coordinator and workers to MySQL. Port 3306 is the default port.++## Create table++At present, the Gravitino connector only supports basic MySQL table creation statements, which involve fields, null allowances, and comments.+However, it does not support advanced features like primary keys, indexes, default values, and auto-increment.++The Gravitino connector does not support `CREATE TABLE AS SELECT`.++## Alter table++Support for the following alter table operations:+- Rename table+- Add a column+- Drop a column+- Change a column type+- Set a table property++## Select++The Gravitino connector supports most SELECT statements, allowing the execution of queries successfully.+Currently, it doesn't support certain query optimizations, such as indexing and pushdowns.++## Table and Schema properties++MySQL's tables and schemas cannot support properties.++## Basic usage examples++First, you need to create a metalake and catalog in Gravitino.+For example, create a new metalake named `test` and create a new catalog named `mysql_test` using the `jdbc-mysql` provider.+And configure the Metalake `test` into the `Graviton connector`.+For More information about the MySQL catalog, please refer to [MySql catalog](../docs/jdbc-mysql-catalog).++```bash+curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "test",+ "comment": "comment",+ "properties": {}+}' http://gravitino-host:8090/api/metalakes++curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "mysql_test",+ "type": "RELATIONAL",+ "comment": "comment",+ "provider": "jdbc-mysql",+ "properties": {+ "jdbc-url": "jdbc:mysql://mysql-host:3306?useSSL=false",+ "jdbc-user": "<username>",+ "jdbc-password": "<password>"+ "jdbc-driver": "com.mysql.cj.jdbc.Driver"+ }+}' http://gravitino-host:8090/api/metalakes/test/catalogs+```++Listing all Gravitino managed catalogs:++```sql+SHOW CATALOGS;+```++The results are similar to:++```text+ Catalog+----------------+ gravitino+ jmx+ system+ test.mysql_test+(4 rows)++Query 20231017_082503_00018_6nt3n, FINISHED, 1 node+```++The `gravitino` catalog is a catalog defined By Trino catalog configuration.+The `test.mysql_test` catalog is the catalog created by you in Gravitino.+Other catalogs are regular user-configured Trino catalogs.++### Creating tables and schemas++Create a new schema named `database_01` in `test.mysql_test` catalog.++```sql+CREATE SCHEMA "test.mysql_test".database_01;+```++Create a new table named `table_01` in schema `"test.mysql_test".database_01`.++```sql+CREATE TABLE "test.mysql_test".database_01.table_01+(+name varchar,+salary int+);+```++### Writing data++Insert data into the table `table_01`:++```sql+INSERT INTO "test.mysql_test".database_01.table_01 (name, salary) VALUES ('ice', 12);+```++Insert data into the table `table_01` from select:++```sql+INSERT INTO "test.mysql_test".database_01.table_01 (name, salary) SELECT * FROM "test.mysql_test".database_01.table_01;+```++### Querying data++Query the `table_01` table:++```sql+SELECT * FROM "test.mysql_test".database_01.table_01;+```++### Modify a table++Add a new column `age` to the `table_01` table:++```sql+ALTER TABLE "test.mysql_test".database_01.table_01 ADD COLUMN age int;+```++Drop a column `age` from the `table_01` table:++```sql+ALTER TABLE "test.mysql_test".database_01.table_01 DROP COLUMN age;+```++Rename the `table_01` table to `table_02`:++```sql+ALTER TABLE "test.mysql_test".database_01.table_01 RENAME TO "test.mysql_test".database_01.table_02;+```++### DROP++Drop a schema:++```sql+DROP SCHEMA "test.mysql_test".database_01;+```++Drop a table:++```sql+DROP TABLE "test.mysql_test".database_01.table_01;+```\ No newline at end of filediff --git a/docs/trino-connector/catalog-postgresql.md b/docs/trino-connector/catalog-postgresql.mdnew file mode 100644index 0000000000..2af7cd8c5c--- /dev/null+++ b/docs/trino-connector/catalog-postgresql.md@@ -0,0 +1,172 @@+---+title: "Gravitino connector - PostgreSQL catalog"+slug: /trino-connector/catalog-postgresql+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++The PostgreSQL catalog allows querying and creating tables in an external PostgreSQL database.+This can be used to join data between different systems like PostgreSQL and Hive, or between different PostgreSQL instances.++## Requirements++To connect to PostgreSQL, you need:+- PostgreSQL 10.x or higher.+- Network access from the Trino coordinator and workers to PostgreSQL. Port 5432 is the default port.++## Create table++At present, the Gravitino connector only supports basic PostgreSQL table creation statements, which involve fields, null allowances, and comments.+However, it does not support advanced features like primary keys, indexes, default values, and auto-increment.++The Gravitino connector does not support `CREATE TABLE AS SELECT`.++## Alter table++Gravitino connector supports the following alter table operations:+- Rename table+- Add a column+- Drop a column+- Rename a column+- Change a column type+- Set a table property++## Select++The Gravitino connector supports most SELECT statements, allowing the execution of queries successfully.+Currently, it doesn't support certain query optimizations, such as indexing and pushdowns.++## Table and Schema properties++PostgreSQL's tables and schemas cannot support properties.++## Basic usage examples++First, you need to create a metalake and catalog in Gravitino.+For example, create a new metalake named `test` and create a new catalog named `postgresql_test` using the `jdbc-postgresql` provider.+And configure the Metalake `test` into the `Graviton connector`.+For More information about the PostgreSQL catalog, please refer to [PostgreSQL catalog](../docs/jdbc-postgressql-catalog).++```bash+curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "test",+ "comment": "comment",+ "properties": {}+}' http://gravitino-host:8090/api/metalakes++curl -X POST -H "Content-Type: application/json" \+-d '{+ "name": "postgresql_test",+ "type": "RELATIONAL",+ "comment": "comment",+ "provider": "jdbc-postgresql",+ "properties": {+ "jdbc-url": "jdbc:postgresql://postgresql-host/mydb",+ "jdbc-user": "<user>",+ "jdbc-password": "<password>",+ "jdbc-database": "mydb",+ "jdbc-driver": "org.postgresql.Driver"+ }+}' http://gravitino-host:8090/api/metalakes/test/catalogs++```++Listing all Gravitino managed catalogs:++```sql+SHOW CATALOGS;+```++The results are similar to:++```text+ Catalog+----------------+ gravitino+ jmx+ system+ test.postgresql_test+(4 rows)++Query 20231017_082503_00018_6nt3n, FINISHED, 1 node+```++The `gravitino` catalog is a catalog defined By Trino catalog configuration.+The `test.postgresql_test` catalog is the catalog created by you in Gravitino.+Other catalogs are regular user-configured Trino catalogs.++### Creating tables and schemas++Create a new schema named `database_01` in `test.postgresql_test` catalog.++```sql+CREATE SCHEMA "test.postgresql_test".database_01;+```++Create a new table named `table_01` in schema `"test.postgresql_test".database_01`.++```sql+CREATE TABLE "test.postgresql_test".database_01.table_01+(+name varchar,+salary int+);+```++### Writing data++Insert data into the table `table_01`:++```sql+INSERT INTO "test.postgresql_test".database_01.table_01 (name, salary) VALUES ('ice', 12);+```++Insert data into the table `table_01` from select:++```sql+INSERT INTO "test.postgresql_test".database_01.table_01 (name, salary) SELECT * FROM "test.postgresql_test".database_01.table_01;+```++### Querying data++Query the `table_01` table:++```sql+SELECT * FROM "test.postgresql_test".database_01.table_01;+```++### Modify a table++Add a new column `age` to the `table_01` table:++```sql+ALTER TABLE "test.postgresql_test".database_01.table_01 ADD COLUMN age int;+```++Drop a column `age` from the `table_01` table:++```sql+ALTER TABLE "test.postgresql_test".database_01.table_01 DROP COLUMN age;+```++Rename the `table_01` table to `table_02`:++```sql+ALTER TABLE "test.postgresql_test".database_01.table_01 RENAME TO "test.postgresql_test".database_01.table_02;+```++### Drop++Drop a schema:++```sql+DROP SCHEMA "test.postgresql_test".database_01;+```++Drop a table:++```sql+DROP TABLE "test.postgresql_test".database_01.table_01;+```\ No newline at end of filediff --git a/docs/trino-connector/configuration.md b/docs/trino-connector/configuration.mdnew file mode 100644index 0000000000..8141c9ba53--- /dev/null+++ b/docs/trino-connector/configuration.md@@ -0,0 +1,12 @@+---+title: "Gravitino connector Configuration"+slug: /trino-connector/configuration+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++| Property | Type | Default Value | Description | Required | Since Version |+|--------------------|--------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------------|+| gravitino.url | string | http://localhost:8090 | The `gravitino.url` defines the connection URL for the Gravitino server. If not set, the default value is `http://localhost:8090`. If the Gravitino server is not starting, Trino can still start normally. Once the Gravitino server is up and running, the Gravitino connector will automatically connect. You can find error details in the Trino logs. | Yes | 0.2.0 |+| gravitino.metalake | string | (none) | The `gravitino.metalake` defines the metalake used. You can create it beforehand or later on. If not set, Trino might throw an error upon startup. It must be set to a valid metalake name. If it's not created, the Gravitino connector continues checking until it's created. Once created, it will load the catalogs, schemas, and tables into Trino and maintain synchronization. | Yes | 0.2.0 |\ No newline at end of filediff --git a/docs/trino-connector/index.md b/docs/trino-connector/index.mdnew file mode 100644index 0000000000..528cdc58c8--- /dev/null+++ b/docs/trino-connector/index.md@@ -0,0 +1,20 @@+---+title: "Gravitino connector index"+slug: /trino-connector/index+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++Gravitino connector index:++- [Trino Support](trino-connector)+ - [Requirements](requirements)+ - [Installation](installation)+ - [Configuration](configuration)+ - [Supported catalogs](supported-catalog)+ - [Hive](catalog-hive)+ - [Iceberg](catalog-iceberg)+ - [MySQL](catalog-mysql)+ - [PostgreSQL](catalog-postgresql)+ - [Supported SQL](sql-support)\ No newline at end of filediff --git a/docs/trino-connector/installation.md b/docs/trino-connector/installation.mdnew file mode 100644index 0000000000..6f724d0238--- /dev/null+++ b/docs/trino-connector/installation.md@@ -0,0 +1,138 @@+---+title: "Gravitino connector installation"+slug: /trino-connector/installation+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++To install the Gravitino connector, first deploy the Trino environment, and then install the Gravitino connector plugin into Trino.+Please refer to the [Deploying Trino documentation](https://trino.io/docs/current/installation/deployment.html).++1. Download the Gravitino connector tarball and unpack it.+ The tarball contains a single top-level directory `gravitino-trino-connector-<version>`,+ which called the connector directory.+ [Download the gravitino-connector](https://github.com/datastrato/gravitino/releases).+2. Copy the connector directory to the Trino's plugin directory.+ Normally, the directory location is `Trino-server-<version>/plugin`, and the directory contains other catalogs used by Trino.+3. Add Trino JVM arguments `-Dlog4j.configurationFile=file:////etc/trino/log4j2.properties` to enable logging for the Gravitino connector.++Alternatively,+you can build the Gravitino connector package from the sources+and obtain the `gravitino-trino-connector-<version>.tar.gz` file in the `$PROJECT/distribution` directory.+Please refer to the [Gravitino Development documentation](../how-to-build)++## Example++You can install the Gravitino connector in Trino office docker images step by step.++### Running the container++Use the docker command to create a container from the `trinodb/trino` image. Assign it the trino-gravitino name.+Run it in the background, and map the default Trino port, which is 8080, from inside the container to port 8080 on your machine.++```shell+docker run --name trino-gravitino -d -p 8080:8080 trinodb/trino:426+```++Run `docker ps` to check whether the container is running.+++### Installing the Gravitino connector++Download the Gravitino connector tarball and unpack it.++```shell+cd /tmp+wget https://github.com/datastrato/gravitino/releases/gravitino-trino-connector-<version>.tar.gz+tar -zxvf gravitino-trino-connector-<version>.tar.gz+```++You can see the connector directory `gravitino-trino-connector-<version>` after unpacking.++Copy the connector directory to the Trino container's plugin directory.++```shell+docker copy /tmp/gravitino-trino-connector-<version> trino-gravitino:/lib/trino/plugin+```++Check the plugin directory in the container.++```shell+docker exec -it trino-gravitino /bin/bash+cd /lib/trino/plugin+```++Now you can see the Gravitino connector directory in the plugin directory.++### Configuring the Gravitino connector++Assuming you have now started the Gravitino server on the host `gravitino-server-host` and can access it properly.+And you have created a metalake named `test`. If not, please refer to the [Gravitino Getting-started](../getting-started)++Add catalog configuration to the Trino configuration file `/etc/trino/catalog/gravitino.properties`.++```text+connector.name=gravitino+gravitino.url=http://gravitino-server-host:8090+gravitino.metalake=test+```++The `gravitino.name` defines which Gravitino connector is used. It must be `gravitino`.+The `gravitino.metalake` defines which metalake are used. It should exist in the Gravitino server.+The `gravitino.uri` defines the connection information about Gravitino server. Make sure your container can access the Gravitino server.++If you don't have the `test` metalake. You can create a new metalake named `test`.++Create a new metalake named `test` by the following command.++```shell+curl -X POST -H "Content-Type: application/json" -d '{"name":"test","comment":"comment","properties":{}}' http://gravitino-server-host:8090/api/metalakes+```++Restart the Trino container to load the Gravitino connector.++```shell+docker restart trino-gravitino+```++### Verifying the Gravitino connector++Use the Trino CLI to connect to the Trino container and run a query.++```text+docker exec -it trino trino+trino> SHOW CATALOGS;+Catalog+------------------------+gravitino+jmx+memory+tpcds+tpch+system+```++You can see the `gravitino` catalog in the result. This signifies the successful installation of the Gravitino connector.++Assuming you have created a catalog named `test.jdbc-mysql` in the Gravitino server.+If you don't have it, please refer to [Create a Catalog](../manage-metadata-using-gravitino#create-a-catalog)++Then you can use the Trino CLI to connect to the Trino container and run a query.++```text+docker exec -it trino trino+trino> SHOW CATALOGS;+Catalog+------------------------+gravitino+jmx+memory+tpcds+tpch+system+test.jdbc-mysql+```++The catalog named 'test.jdbc-mysql' is your created catalog by gravitino server.+You can use it to access the mysql database like other Trino catalogs.\ No newline at end of filediff --git a/docs/trino-connector/requirements.md b/docs/trino-connector/requirements.mdnew file mode 100644index 0000000000..2fc26e3b1d--- /dev/null+++ b/docs/trino-connector/requirements.md@@ -0,0 +1,18 @@+---+title: "Gravitino connector requirements"+slug: /trino-connector/requirements+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++To install and deploy the Gravitino connector, The following environmental setup is necessary:++- Trino server version should be higher than Trino-server-360, ideally using Trino-server-426.+ Other versions of Trino have not undergone thorough testing.+- Ensure that all nodes running Trino can access the Gravitino server's port, which defaults to 8090.+- Ensure that all nodes running Trino can access the real catalogs resources, such as Hive, Iceberg, MySQL, PostgreSQL, etc.+- Ensure that you have installed the following connectors in Trino: Hive, Iceberg, MySQL, PostgreSQL.+- Ensure that you have set the `catalog.management` to `static` in the Trino configuration.+- Ensure that you have set the `allow_pushdown_into_connectors` to `false` in the Trino session configuration.+diff --git a/docs/trino-connector/sql-support.md b/docs/trino-connector/sql-support.mdnew file mode 100644index 0000000000..aefc854500--- /dev/null+++ b/docs/trino-connector/sql-support.md@@ -0,0 +1,49 @@+---+title: "Gravitino connector SQL support"+slug: /trino-connector/sql-support+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++The connector provides read access and write access to data and metadata stored in Gravitino.++### Globally available statements++- [EXPLAIN](https://trino.io/docs/current/sql/explain.html)+- [EXPLAIN ANALYZE](https://trino.io/docs/current/sql/explain-analyze.html)+- [PREPARE](https://trino.io/docs/current/sql/prepare.html)+- [USE](https://trino.io/docs/current/sql/use.html)++### Read operations++- [SELECT](https://trino.io/docs/current/sql/select.html)+- [DESCRIBE](https://trino.io/docs/current/sql/describe.html)+- [SHOW CATALOGS](https://trino.io/docs/current/sql/show-catalogs.html)+- [SHOW COLUMNS](https://trino.io/docs/current/sql/show-columns.html)+- [SHOW CREATE SCHEMA](https://trino.io/docs/current/sql/show-create-schema.html)+- [SHOW CREATE TABLE](https://trino.io/docs/current/sql/show-create-table.html)+- [SHOW SCHEMAS](https://trino.io/docs/current/sql/show-schemas.html)+- [SHOW TABLES](https://trino.io/docs/current/sql/show-tables.html)++### Write operations++- [INSERT](https://trino.io/docs/current/sql/insert.html)+- [INSERT INTO SELECT](https://trino.io/docs/current/sql/insert.html)++### Schema and table management++- [CREATE TABLE](https://trino.io/docs/current/sql/create-table.html)+- [DROP TABLE](https://trino.io/docs/current/sql/drop-table.html)+- [ALTER TABLE](https://trino.io/docs/current/sql/alter-table.html)+- [CREATE SCHEMA](https://trino.io/docs/current/sql/create-schema.html)+- [DROP SCHEMA](https://trino.io/docs/current/sql/drop-schema.html)+- [COMMENT](https://trino.io/docs/current/sql/comment.html)++### Transactions++- [START TRANSACTION](https://trino.io/docs/current/sql/start-transaction.html)+- [COMMIT](https://trino.io/docs/current/sql/commit.html)+- [ROLLBACK](https://trino.io/docs/current/sql/rollback.html)++For more information, please refer to Trino [SQL statements support](https://trino.io/docs/current/language/sql-support.html#sql-globally-available)\ No newline at end of filediff --git a/docs/trino-connector/supported-catalog.md b/docs/trino-connector/supported-catalog.mdnew file mode 100644index 0000000000..be35c39c12--- /dev/null+++ b/docs/trino-connector/supported-catalog.md@@ -0,0 +1,44 @@+---+title: "Gravitino supported Catalogs"+slug: /trino-connector/supported-catalog+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++The catalogs currently supported by the Gravitino connector are as follows:++- [Hive](catalog-hive)+- [Iceberg](catalog-iceberg)+- [MySQL](catalog-mysql)+- [PostgreSQL](catalog-postgresql)++## Create catalog++Trino currently does not support creating Gravitino managed catalogs.+If you need to create a catalog, please refer to:+- [Create a Catalog](../manage-metadata-using-gravitino#create-a-catalog)++## Data type mapping++All types of catalogs support the following data type conversions.+Data Type Conversion between Trino and Gravitino is as following:++| Gravitino Type | Trino Type |+|----------------|------------|+| BooleanType | BOOLEAN |+| ByteType | TINYINT |+| ShortType | SMALLINT |+| IntegerType | INTEGER |+| LongType | BIGINT |+| FloatType | REAL |+| DoubleType | DOUBLE |+| DecimalType | DECIMAL |+| StringType | VARCHAR |+| VarcharType | VARCHAR |+| BinaryType | VARBINARY |+| TimestampType | TIMESTAMP |+| DateType | DATE |+| ArrayType | ARRAY |+| MapType | MAP |+| StructType | ROW |\ No newline at end of filediff --git a/docs/trino-connector/trino-connector.md b/docs/trino-connector/trino-connector.mdnew file mode 100644index 0000000000..aef383756c--- /dev/null+++ b/docs/trino-connector/trino-connector.md@@ -0,0 +1,29 @@+---+title: "Gravitino connector"+slug: /trino-connector/trino-connector+keyword: gravitino connector trino+license: "Copyright 2023 Datastrato Pvt Ltd.+This software is licensed under the Apache License version 2."+---++Trino can manage and access data using the Trino connector provided by `Gravitino`, commonly referred to as the `Gravitino connector`.+After configuring the Gravitino connector in Trino, it can automatically load catalog metadata from Gravitino, allowing users to directly access these catalogs in Trino.+Once integrated with Gravitino, Trino can operate on all Gravitino data without requiring additional configuration.++When metadata such as catalogs, schemas, or tables change in Gravitino, Trino can also update itself through Gravitino.+++The loading of Gravitino's catalogs into Trino follows the naming convention:++```text+{metalake}.{catalog}+```++Regarding `metalake` and `catalog`,+you can refer to [Create a Metalake](../manage-metadata-using-gravitino#create-a-metalake), [Create a Catalog](../manage-metadata-using-gravitino#create-a-catalog).++Usage in queries is as follows:++```text+SELECT * from "metalake.catalog".dbname.tabname+```\ No newline at end of filediff --git a/docs/trino-gravitino-connector.md b/docs/trino-gravitino-connector.mddeleted file mode 100644index be9f722a6c..0000000000--- a/docs/trino-gravitino-connector.md+++ /dev/null@@ -1,145 +0,0 @@-----title: "Gravitino connector"-date: 2023-10-17T11:05:00-08:00-license: "Copyright 2023 Datastrato Pvt Ltd.-This software is licensed under the Apache License version 2."-----## Gravitino connector--The Gravitino connector manages query tables with Gravitino.-Manage catalogs, schemas, and tables using this to dynamically load them into Trino. Query data from databases on the server or combine it with other data from different catalogs accessed from any other supported data source.--### Supported catalog types--The Gravitino connector supports various Trino connector types, including:--- [Hive catalog](gravitino-manage-hive.md)--## Requirements--To connect to a Gravitino server, you should ensure the following things.--- Trino server version is higher than Trino-server-360.-- Trino's coordinators and workers can connect/access the Gravitino server, and the default port of the Gravitino server is 8090.-- Trino needs to install connectors for all different types of Gravitino-managed catalogs.--## Installation--To install the Gravitino connector, first deploy the Trino environment, and then install the Gravitino connector plugin into Trino.-Please refer to the [Deploying Trino documentation](https://trino.io/docs/current/installation/deployment.html).--1. Download the Gravitino connector tarball and unpack it.- The tarball contains a single top-level directory `gravitino-trino-connector-xxx`,- which we call the connector directory.- [Download the gravitino-connector](https://github.com/datastrato/gravitino/releases).-2. Copy the connector directory to the Trino's plugin directory.- Normally, the directory location is `Trino-server-xxx/plugin`, and the directory contains other catalogs used by Trino.-3. Add Trino JVM arguments `-Dlog4j.configurationFile=file:///xxx/log4j2.properties` to enable logging for the Gravitino connector.--Alternatively,-you can build the Gravitino connector package from sources-and obtain the `gravitino-trino-connector-xxx.tar.gz` file in the `$PROJECT/distribution` directory.-Please refer to the [Gravitino Development documentation](how-to-build.md)--## Configuration--The connector can access a Gravitino server. Create a catalog properties file that specifies the Gravitino connector by setting the `connector.name` to `gravitino`.--For example, create the file etc/catalog/gravitino.properties. Replace the connection properties as appropriate for your setup:--```text-connector.name=gravitino-gravitino.uri=http://host:8090-gravitino.metalake=test-```--The `gravitino.uri` defines the connection information about Gravitino server.-The `gravitino.metalake` defines which metalake are used. It should exist in the Gravitino server.-Please refer to the [Metalake documentation](overview.md#terminology )--### Multiple Gravitino metalakes--If you have multiple Gravitino metalakes, you need to configure a catalog for each metalake. To add another catalog:--- Add another properties file to `etc/catalog`-- Save it with a different name that ends in `.properties`--For example, if you name the property file sales.properties. Trino uses the configured connector to create a catalog named `sales`--## SQL support--The connector provides read access and write access to data and metadata in the Gravitino-managed catalogs and its storage system.--### Basic usage examples--First, you need to create a metalake and catalog in Gravitino.-For example, create a new metalake named `test` and create a new catalog named `hive_test` using the hive provider.--Listing all Gravitino manager catalogs--```sql-show catalogs-```--The results like:--```text- Catalog------------------ gravitino- jmx- system- test.hive_test-(4 rows)--Query 20231017_082503_00018_6nt3n, FINISHED, 1 node-```--The `gravitino` catalog is a catalog defined Trino catalog configuration.-Is is generally not used.-The `test.hive_test` catalog is Gravitino Hive managed catalog,-dynamically loaded from the `gravitino` catalog in Gravitino.-Other catalogs are regular user-configured Trino catalogs.--Create a new schema named `database_01` in `test.hive_test` catalog.--```sql-create schema "test.hive_test".database_01;-```--Create a new table named `table_01` in schema `"test.hive_test".database_01` and stored in a TEXTFILE format.--```sql-create table "test.hive_test".database_01.table_01-(-name varchar,-salary int-)-WITH (- format = 'TEXTFILE'-);-```--Drop a schema:--```sql-drop schema "test.hive_test".database_01;-```--Drop a table:--```sql-drop table "test.hive_test".database_01.table_01;-```--Query the `table_01` table:--```sql-select * from "test.hive_test".database_01.table_01;-```--Insert data into the table `table_01`:--```sql-insert into "test.hive_test".database_01.table_01 (name, salary) values ('ice', 12);-```