Skip to main content
Version: 0.8.0-incubating

Apache Gravitino Flink connector

Overview

The Apache Gravitino Flink connector implements the Catalog Store to manage the catalogs under Gravitino. This capability allows users to perform federation queries, accessing data from various catalogs through a unified interface and consistent access control.

Capabilities

  1. Supports Hive catalog
  2. Supports Iceberg catalog
  3. Supports Paimon catalog
  4. Supports most DDL and DML SQLs.

Requirement

  • Flink 1.18
  • Scala 2.12
  • JDK 8 or 11 or 17

How to use it

  1. Build or download the Gravitino flink connector runtime jar, and place it to the classpath of Flink.
  2. Configure the Flink configuration to use the Gravitino flink connector.
PropertyTypeDefault ValueDescriptionRequiredSince Version
table.catalog-store.kindstringgeneric_in_memoryThe Catalog Store name, it should set to gravitino.Yes0.6.0-incubating
table.catalog-store.gravitino.gravitino.metalakestring(none)The metalake name that flink connector used to request to Gravitino.Yes0.6.0-incubating
table.catalog-store.gravitino.gravitino.uristring(none)The uri of Gravitino server address.Yes0.6.0-incubating

Set the flink configuration in flink-conf.yaml.

table.catalog-store.kind: gravitino
table.catalog-store.gravitino.gravitino.metalake: test
table.catalog-store.gravitino.gravitino.uri: http://localhost:8090

Or you can set the flink configuration in the TableEnvironment.

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.uri", "http://localhost:8090");
EnvironmentSettings.Builder builder = EnvironmentSettings.newInstance().withConfiguration(configuration);
TableEnvironment tableEnv = TableEnvironment.create(builder.inBatchMode().build());
  1. Execute the Flink SQL query.

Suppose there is only one hive catalog with the name hive in the metalake test.

// use hive catalog
USE hive;
CREATE DATABASE db;
USE db;
CREATE TABLE hive_students (id INT, name STRING);
INSERT INTO hive_students VALUES (1, 'Alice'), (2, 'Bob');
SELECT * FROM hive_students;

Datatype mapping

Gravitino flink connector support the following datatype mapping between Flink and Gravitino.

Flink TypeGravitino TypeSince Version
arraylist0.6.0-incubating
bigintlong0.6.0-incubating
binaryfixed0.6.0-incubating
booleanboolean0.6.0-incubating
charchar0.6.0-incubating
datedate0.6.0-incubating
decimaldecimal0.6.0-incubating
doubledouble0.6.0-incubating
floatfloat0.6.0-incubating
integerinteger0.6.0-incubating
mapmap0.6.0-incubating
nullnull0.6.0-incubating
rowstruct0.6.0-incubating
smallintshort0.6.0-incubating
timetime0.6.0-incubating
timestamptimestamp without time zone0.6.0-incubating
timestamp without time zonetimestamp without time zone0.6.0-incubating
timestamp with time zonetimestamp with time zone0.6.0-incubating
timestamp with local time zonetimestamp with time zone0.6.0-incubating
timestamp_ltztimestamp with time zone0.6.0-incubating
tinyintbyte0.6.0-incubating
varbinarybinary0.6.0-incubating
varcharstring0.6.0-incubating