You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by sh...@apache.org on 2025/08/04 11:21:57 UTC
(gravitino) branch update_flink_connector_doc created (now c593c47c49)
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a change to branch update_flink_connector_doc
in repository https://gitbox.apache.org/repos/asf/gravitino.git
at c593c47c49 update flink connector document
This branch includes the following new commits:
new c593c47c49 update flink connector document
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(gravitino) 01/01: update flink connector document
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch update_flink_connector_doc
in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit c593c47c49ced77e18107b41eacdf5e80fa2a831
Author: Shaofeng Shi <sh...@gmail.com>
AuthorDate: Mon Aug 4 19:21:42 2025 +0800
update flink connector document
---
docs/flink-connector/flink-catalog-hive.md | 16 +++++++++++-----
docs/flink-connector/flink-catalog-jdbc.md | 6 ++++++
docs/flink-connector/flink-connector.md | 15 ++++++++++-----
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/docs/flink-connector/flink-catalog-hive.md b/docs/flink-connector/flink-catalog-hive.md
index 9fc9349e35..057cd4d0d0 100644
--- a/docs/flink-connector/flink-catalog-hive.md
+++ b/docs/flink-connector/flink-catalog-hive.md
@@ -39,18 +39,24 @@ USE CATALOG hive_a;
CREATE DATABASE IF NOT EXISTS mydatabase;
USE mydatabase;
+SET 'execution.runtime-mode' = 'batch';
+-- [INFO] Execute statement succeed.
+
+SET 'sql-client.execution.result-mode' = 'tableau';
+-- [INFO] Execute statement succeed.
+
// Create table
CREATE TABLE IF NOT EXISTS employees (
id INT,
name STRING,
- date INT
+ dt INT
)
-PARTITIONED BY (date);
+PARTITIONED BY (dt);
-DESC TABLE EXTENDED employees;
+DESC EXTENDED employees;
-INSERT INTO TABLE employees VALUES (1, 'John Doe', 20240101), (2, 'Jane Smith', 20240101);
-SELECT * FROM employees WHERE date = '20240101';
+INSERT INTO employees VALUES (1, 'John Doe', 20240101), (2, 'Jane Smith', 20240101);
+SELECT * FROM employees WHERE dt = 20240101;
```
## Catalog properties
diff --git a/docs/flink-connector/flink-catalog-jdbc.md b/docs/flink-connector/flink-catalog-jdbc.md
index 4414500f4e..31c084abda 100644
--- a/docs/flink-connector/flink-catalog-jdbc.md
+++ b/docs/flink-connector/flink-catalog-jdbc.md
@@ -23,6 +23,12 @@ Place the following JAR files in the lib directory of your Flink installation:
- [`gravitino-flink-connector-runtime-1.18_2.12-${gravitino-version}.jar`](https://mvnrepository.com/artifact/org.apache.gravitino/gravitino-flink-connector-runtime-1.18)
- JDBC driver
+Next, edit the JDBC catalog in Gravitino, add the `flink.bypass.default-database` property, and give it an value of the default database.
+
+```json
+flink.bypass.default-database=db
+```
+
### SQL Example
```sql
diff --git a/docs/flink-connector/flink-connector.md b/docs/flink-connector/flink-connector.md
index 84067ecbeb..da49bee38d 100644
--- a/docs/flink-connector/flink-connector.md
+++ b/docs/flink-connector/flink-connector.md
@@ -38,28 +38,33 @@ This capability allows users to perform federation queries, accessing data from
Set the flink configuration in flink-conf.yaml.
```yaml
table.catalog-store.kind: gravitino
-table.catalog-store.gravitino.gravitino.metalake: test
+table.catalog-store.gravitino.gravitino.metalake: metalake_demo
table.catalog-store.gravitino.gravitino.uri: http://localhost:8090
```
Or you can set the flink configuration in the `TableEnvironment`.
```java
final Configuration configuration = new Configuration();
configuration.setString("table.catalog-store.kind", "gravitino");
-configuration.setString("table.catalog-store.gravitino.gravitino.metalake", "test");
+configuration.setString("table.catalog-store.gravitino.gravitino.metalake", "metalake_demo");
configuration.setString("table.catalog-store.gravitino.gravitino.uri", "http://localhost:8090");
EnvironmentSettings.Builder builder = EnvironmentSettings.newInstance().withConfiguration(configuration);
TableEnvironment tableEnv = TableEnvironment.create(builder.inBatchMode().build());
```
-3. Execute the Flink SQL query.
+3. Add necessary jar files to Flink's `lib` sub-folder.
+To run Flink with Gravitino connector and then access the data sources like Hive, Iceberg and others, you need to put the necessary jar files into Flink's `lib` folder. For example, to access Hive, you need to add at least these jar files: `flink-connector-hive_{version}.jar`, `hive-metastore-{version}.jar`, `hive-exec-{version}-core.jar`, `hive-serde-{version}.jar`, `hive-shims-common-{version}.jar`, `hive-storage-api-{version}.jar`, etc.
-Suppose there is only one hive catalog with the name `hive` in the metalake `test`.
+4. Execute the Flink SQL query.
+
+Suppose there is only one hive catalog with the name `catalog_hive` in the metalake `metalake_demo`.
```sql
// use hive catalog
-USE hive;
+USE CATALOG catalog_hive;
CREATE DATABASE db;
USE db;
+SET 'execution.runtime-mode' = 'batch';
+SET 'sql-client.execution.result-mode' = 'tableau';
CREATE TABLE hive_students (id INT, name STRING);
INSERT INTO hive_students VALUES (1, 'Alice'), (2, 'Bob');
SELECT * FROM hive_students;