Sink data from RisingWave to Apache Iceberg
This guide describes how to sink data from RisingWave to Apache Iceberg using the Iceberg sink connector in RisingWave. Apache Iceberg is a table format designed to support huge tables. For more information, see Apache Iceberg.
PUBLIC PREVIEW
This feature is in the public preview stage, meaning it’s nearing the final product but is not yet fully stable. If you encounter any issues or have feedback, please contact us through our Slack channel. Your input is valuable in helping us improve the feature. For more information, see our Public preview feature list.
Prerequisites
- Ensure you already have an Iceberg table that you can sink data to. For additional guidance on creating a table and setting up Iceberg, refer to this quickstart guide on creating an Iceberg table.
- Ensure you have an upstream materialized view or source that you can sink data from.
Syntax
Parameters
Parameter Names | Description |
---|---|
type | Required. Allowed values: appendonly and upsert. |
force_append_only | Optional. If true, forces the sink to be append-only, even if it cannot be. |
s3.endpoint | Optional. Endpoint of the S3. For MinIO object store backend, it should be http://. For AWS S3, refer to S3 |
s3.region | Optional. The region where the S3 bucket is hosted. Either s3.endpoint or s3.region must be specified. |
s3.access.key | Required. Access key of the S3 compatible object store. |
s3.secret.key | Required. Secret key of the S3 compatible object store. |
database.name | Required. The database of the target Iceberg table. |
table.name | Required. The name of the target Iceberg table. |
catalog.name | Conditional. The name of the Iceberg catalog. It can be omitted for storage catalog but required for other catalogs. |
catalog.type | Optional. The catalog type used in this table. Currently, the supported values are storage, rest, hive, jdbc, and glue. If not specified, storage is used. For details, see Catalogs. |
warehouse.path | Conditional. The path of the Iceberg warehouse. Currently, only S3-compatible object storage systems, such as AWS S3 and MinIO, are supported. It’s required if the catalog.type is not rest. |
catalog.url | Conditional. The URL of the catalog. It is required when catalog.type is not storage. |
primary_key | The primary key for an upsert sink. It is only applicable to the upsert mode. |
commit_checkpoint_interval | Optional. Commit every N checkpoints (N > 0). Default value is 10. The behavior of this field also depends on the sink_decouple setting:If sink_decouple is true (the default), the default value of commit_checkpoint_interval is 10. If sink_decouple is set to false, the default value of commit_checkpoint_interval is 1. If sink_decouple is set to false and commit_checkpoint_interval is set to larger than 1, an error will occur. |
Data type mapping
RisingWave converts risingwave data types from/to Iceberg according to the following data type mapping table:
RisingWave Type | Iceberg Type |
---|---|
boolean | boolean |
int | integer |
bigint | long |
real | float |
double | double |
varchar | string |
date | date |
timestamptz | timestamptz |
timestamp | timestamp |
Catalog
Iceberg supports these types of catalogs:
Storage catalog
The Storage catalog stores all metadata in the underlying file system, such as Hadoop or S3. Currently, we only support S3 as the underlying file system.
Examples
REST catalog
RisingWave supports the REST catalog, which acts as a proxy to other catalogs like Hive, JDBC, and Nessie catalog. This is the recommended approach to use RisingWave with Iceberg tables.
Examples
Hive catalog
RisingWave supports the Hive catalog. You need to set catalog.type
to hive
to use it.
Examples
Jdbc catalog
RisingWave supports the JDBC catalog.
Examples
Glue catalog
Premium Edition Feature
This feature is only available in the premium edition of RisingWave. The premium edition offers additional advanced features and capabilities beyond the free and community editions. If you have any questions about upgrading to the premium edition, please contact our sales team at sales@risingwave-labs.com.
RisingWave supports the Glue catalog. You should use AWS S3 if you use the Glue catalog. Below are example codes for using this catalog:
Examples
Iceberg table format
Currently, RisingWave only supports Iceberg tables in format v2.
Examples
This section includes several examples that you can use if you want to quickly experiment with sinking data to Iceberg.
Create an Iceberg table (if you do not already have one)
For example, the following spark-sql
command creates an Iceberg table named table
under the database dev
in AWS S3. The table is in an S3 bucket named my-iceberg-bucket
in region ap-southeast-1
and under the path path/to/warehouse
. The table has the property format-version=2
, so it supports the upsert option. There should be a folder named s3://my-iceberg-bucket/path/to/warehouse/dev/table/metadata
.
Note that only S3-compatible object store is supported, such as AWS S3 or MinIO.
Create an upstream materialized view or source
The following query creates an append-only source. For more details on creating a source, see CREATE SOURCE .
Another option is to create an upsert table, which supports in-place updates. For more details on creating a table, see CREATE TABLE .
Append-only sink from append-only source
If you have an append-only source and want to create an append-only sink, set type = append-only
in the CREATE SINK
SQL query.
Append-only sink from upsert source
If you have an upsert source and want to create an append-only sink, set type = append-only
and force_append_only = true
. This will ignore delete messages in the upstream, and to turn upstream update messages into insert messages.
Upsert sink from upsert source
In RisingWave, you can directly sink data as upserts into Iceberg tables.
Was this page helpful?