StarRocks
This documentation is a guide for using Paimon in StarRocks.
Version
Paimon currently supports StarRocks 3.1 and above. Recommended version is StarRocks 3.2.6 or above.
Create Paimon Catalog
Paimon catalogs are registered by executing a CREATE EXTERNAL CATALOG
SQL in StarRocks. For example, you can use the following SQL to create a Paimon catalog named paimon_catalog.
CREATE EXTERNAL CATALOG paimon_catalog
PROPERTIES
(
"type" = "paimon",
"paimon.catalog.type" = "filesystem",
"paimon.catalog.warehouse" = "oss://<your_bucket>/user/warehouse/"
);
More catalog types and configures can be seen in Paimon catalog.
Query
Suppose there already exists a database named test_db
and a table named test_tbl
in paimon_catalog
, you can query this table using the following SQL:
SELECT * FROM paimon_catalog.test_db.test_tbl;
Query System Tables
You can access all kinds of Paimon system tables by StarRocks. For example, you can read the ro
(read-optimized) system table to improve reading performance of primary-key tables.
SELECT * FROM paimon_catalog.test_db.test_tbl$ro;
For another example, you can query partition files of the table using the following SQL:
SELECT * FROM paimon_catalog.test_db.partition_tbl$partitions;
/*
+-----------+--------------+--------------------+------------+----------------------------+
| partition | record_count | file_size_in_bytes | file_count | last_update_time |
+-----------+--------------+--------------------+------------+----------------------------+
| [1] | 1 | 645 | 1 | 2024-01-01 00:00:00.000000 |
+-----------+--------------+--------------------+------------+----------------------------+
*/
StarRocks to Paimon type mapping
This section lists all supported type conversion between StarRocks and Paimon. All StarRocks’s data types can be found in this doc StarRocks Data type overview.
StarRocks Data Type | Paimon Data Type | Atomic Type |
---|---|---|
STRUCT | RowType | false |
MAP | MapType | false |
ARRAY | ArrayType | false |
BOOLEAN | BooleanType | true |
TINYINT | TinyIntType | true |
SMALLINT | SmallIntType | true |
INT | IntType | true |
BIGINT | BigIntType | true |
FLOAT | FloatType | true |
DOUBLE | DoubleType | true |
CHAR(length) | CharType(length) | true |
VARCHAR(MAX_VARCHAR_LENGTH) | VarCharType(VarCharType.MAX_LENGTH) | true |
VARCHAR(length) | VarCharType(length), length is less than VarCharType.MAX_LENGTH | true |
DATE | DateType | true |
DATETIME | TimestampType | true |
DECIMAL(precision, scale) | DecimalType(precision, scale) | true |
VARBINARY(length) | VarBinaryType(length) | true |
DATETIME | LocalZonedTimestampType | true |