Skip to main content
Version: 1.13.0

Iceberg

Overview

Apache Iceberg is a high-performance format for huge analytic tables.

Version

Extract NodeVersion
IcebergIceberg: 0.12.x, 0.13.x

Dependencies

<dependency>
<groupId>org.apache.inlong</groupId>
<artifactId>sort-connector-iceberg</artifactId>
<version>1.13.0-SNAPSHOT</version>
</dependency>

Usage

Before creating the Iceberg task, we need a Flink environment integrated with Hadoop.

  • Download Apache Hadoop.
  • Modify jobmanager.sh and taskmanager.sh and add Hadoop environment variables. For commands, please refer to Apache Flink.
export HADOOP_CLASSPATH=`$HADOOP_HOME/bin/hadoop classpath`
  • Modify docker-compose.yml in the docker/docker-compose and mount Hadoop and Flink startup commands into the container:
  jobmanager:
image: apache/flink:1.13-scala_2.11
container_name: jobmanager
user: root
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
volumes:
# Mount Hadoop
- HADOOP_HOME:HADOOP_HOME
# Mount the modified jobmanager.sh which adds the HADOOP_HOME env correctly
- /jobmanager.sh:/opt/flink/bin/jobmanager.sh
ports:
- "8081:8081"
command: jobmanager

taskmanager:
image: apache/flink:1.13-scala_2.11
container_name: taskmanager
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
taskmanager.numberOfTaskSlots: 2
volumes:
# Mount Hadoop
- HADOOP_HOME:HADOOP_HOME
# Mount the modified taskmanager.sh which adds the HADOOP_HOME env correctly
- /taskmanager.sh:/opt/flink/bin/taskmanager.sh
command: taskmanager

Before using Flink sql client, sql-client.sh also needs to add Hadoop environment variables and mounted to the container. For commands, please refer to Apache Flink.

export HADOOP_CLASSPATH=`$HADOOP_HOME/bin/hadoop classpath`

使用 Flink sql cli

CREATE TABLE `iceberg_table_source`(
PRIMARY KEY (`_id`) NOT ENFORCED,
`_id` STRING,
`id` INT,
`name` STRING,
`age` INT)
WITH (
'connector' = 'iceberg-inlong',
'catalog-database' = 'DATABASES',
'catalog-table' = 'TABLE',
'catalog-type' = 'HIVE',
'catalog-name' = 'HIVE',
'streaming' = 'true',
'uri' = 'thrift://127.0.0.1:9083'
);

Dashboard

Source → Create → Iceberg

img.png

Manager Client

TODO

Options

OptionsRequiredTypeDescription
connectorrequiredStringSpecify what connector to use, here should be 'iceberg-inlong'
catalog-databaserequiredStringDatabase name managed in the Iceberg directory
catalog-tablerequiredStringTable name managed in Iceberg catalogs and databases
catalog-typerequiredStringhive or hadoop for built-in directories
catalog-namerequiredStringdirectory name
urirequiredStringThe thrift URI of Hive metastore, such as: thrift://127.0.0.1:9083
warehouseoptionalStringFor a Hive directory, the Hive repository location. For the hadoop directory, it is the HDFS directory that stores metadata files and data files.
inlong.metric.labelsoptionalStringIn long metric label, the format of value is groupId=xxgroup&streamId=xxstream&nodeId=xxnode

Data Type Mapping

Flink SQL TypeIceberg Type
CHARSTRING
VARCHARSTRING
STRINGSTRING
BOOLEANBOOLEAN
BINARYFIXED(L)
VARBINARYBINARY
DECIMALDECIMAL(P,S)
TINYINTINT
SMALLINTINT
INTEGERINT
BIGINTLONG
FLOATFLOAT
DOUBLEDOUBLE
DATEDATE
TIMETIME
TIMESTAMPTIMESTAMP
TIMESTAMP_LTZTIMESTAMPTZ
INTERVAL-
ARRAYLIST
MULTISETMAP
MAPMAP
ROWSTRUCT
RAW-