This message was deleted.
# questions-and-troubleshooting
s
This message was deleted.
r
Yes, with StarRocks 4.0 (and starting from version 3.1), you can create Iceberg tables with a partitioning scheme directly through an Iceberg catalog. StarRocks supports both standard partitioning and hidden partitioning (using Iceberg transform expressions). Key Features for Iceberg Table Creation: 1. Standard Partitioning: You can partition by one or more columns. 2. Hidden Partitioning: You can use transform expressions defined in the Apache Iceberg specification, such as: *
bucket(N, column)
*
year(column)
,
month(column)
,
day(column)
,
hour(column)
*
truncate(L, column)
3. Sort Keys (v4.0 feature): Specifically in version 4.0 and later, StarRocks also supports the
ORDER BY
clause to specify sort keys for Iceberg tables, which helps optimize data layout within the files. Example Syntax: To create a partitioned Iceberg table, you must first switch to or use an Iceberg catalog:
Copy code
sql
-- Create a table with standard partitioning
CREATE TABLE iceberg_catalog.db_name.sample_table (
    id INT,
    event_time DATETIME,
    data VARCHAR(255)
) 
PARTITION BY (event_time);

-- Create a table with hidden partitioning (e.g., by month and bucket)
CREATE TABLE iceberg_catalog.db_name.hidden_part_table (
    user_id INT,
    event_date DATE,
    action VARCHAR(20)
)
PARTITION BY bucket(user_id, 16), month(event_date);

-- Version 4.0 feature: Adding sort keys
CREATE TABLE iceberg_catalog.db_name.sorted_table (
    id INT,
    category INT,
    ts DATETIME
)
PARTITION BY day(ts)
ORDER BY (category ASC, id DESC);
Important Notes: * Catalog Requirement: You must perform these operations within an Iceberg Catalog (using HMS, AWS Glue, etc.). * Column Order: Partition columns must be defined after non-partition columns in the
CREATE TABLE
statement. * Default Values: All non-partition columns must use
NULL
as the default value (e.g.,
DEFAULT "NULL"
). Partition columns cannot use
NULL
as a default value. * Data Types: Partition columns do not support
FLOAT
,
DOUBLE
,
DECIMAL
, or
DATETIME
directly (though you can use transforms like
day()
on date/time types). Referencesdata_source/catalog/iceberg/iceberg_catalog.mddata_source/feature-support-data-lake-analytics.mdquick_start/iceberg.mddata_source/catalog/iceberg/iceberg_timetravel.mdrelease_notes/release-2.1.md
c
@Rocky When I specify format-version = 2 In iceberg properties, I get an error: Multiple entries with same key: format-version=1 and format-version=2. Does Starrocks 4.06 support V2 iceberg?
c
@Rocky starrocks is creating my iceberg tables with "format-version":1. It used to create them as "format-version":2. Is there something I can do to force V2?