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.

  1. CREATE EXTERNAL CATALOG paimon_catalog
  2. PROPERTIES
  3. (
  4. "type" = "paimon",
  5. "paimon.catalog.type" = "filesystem",
  6. "paimon.catalog.warehouse" = "oss://<your_bucket>/user/warehouse/"
  7. );

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:

  1. 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.

  1. SELECT * FROM paimon_catalog.test_db.test_tbl$ro;

For another example, you can query partition files of the table using the following SQL:

  1. SELECT * FROM paimon_catalog.test_db.partition_tbl$partitions;
  2. /*
  3. +-----------+--------------+--------------------+------------+----------------------------+
  4. | partition | record_count | file_size_in_bytes | file_count | last_update_time |
  5. +-----------+--------------+--------------------+------------+----------------------------+
  6. | [1] | 1 | 645 | 1 | 2024-01-01 00:00:00.000000 |
  7. +-----------+--------------+--------------------+------------+----------------------------+
  8. */

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 TypePaimon Data TypeAtomic Type
STRUCTRowTypefalse
MAPMapTypefalse
ARRAYArrayTypefalse
BOOLEANBooleanTypetrue
TINYINTTinyIntTypetrue
SMALLINTSmallIntTypetrue
INTIntTypetrue
BIGINTBigIntTypetrue
FLOATFloatTypetrue
DOUBLEDoubleTypetrue
CHAR(length)CharType(length)true
VARCHAR(MAX_VARCHAR_LENGTH)VarCharType(VarCharType.MAX_LENGTH)true
VARCHAR(length)VarCharType(length), length is less than VarCharType.MAX_LENGTHtrue
DATEDateTypetrue
DATETIMETimestampTypetrue
DECIMAL(precision, scale)DecimalType(precision, scale)true
VARBINARY(length)VarBinaryType(length)true
DATETIMELocalZonedTimestampTypetrue