Eliezer Talker
06/07/2026, 9:58 AMRocky
06/07/2026, 9:58 AMcol.field) for the JSON data type. However, dot notation is supported for the STRUCT data type.
Since your goal is to use StarRocks as a federated engine with hot data (internal) and cold data (Iceberg), here is how you can resolve the syntax mismatch:
1. The Recommended Fix: Use STRUCT in StarRocks
StarRocks introduced support for the STRUCT data type in internal tables starting with v3.1. For external Iceberg tables, STRUCT fields are mapped to StarRocks STRUCT types (supported since v2.5).
If you define your internal StarRocks table using the STRUCT type instead of JSON, you can use dot notation for both:
* Internal Table (Hot):
sql
CREATE TABLE hot_data (
id INT,
user_info STRUCT<name STRING, age INT>
) ...;
SELECT user_info.name FROM hot_data; -- This works
* Iceberg Table (Cold):
sql
-- StarRocks automatically maps Iceberg structs to its internal STRUCT type
SELECT user_info.name FROM iceberg_catalog.db.cold_data; -- This also works
2. If you must use JSON in the internal table
If you are on a version earlier than 3.1 or require the dynamic nature of JSON for your hot data, you must use the arrow operator (->) or JSON functions. Dot notation will not work.
* JSON Syntax: column->'path'
sql
-- If user_info is a JSON column
SELECT user_info->'name' FROM hot_data;
* Accessing nested fields: column->'field'->'subfield' or get_json_string(column, '$.field.subfield').
Summary Comparison
Feature | JSON Type | STRUCT Type
Dot Notation (col.field) | ❌ No | ✅ Yes
Arrow Operator (col->'f') | ✅ Yes | ❌ No
Schema | Flexible / Dynamic | Fixed / Strongly Typed
StarRocks Version | v2.2+ | v3.1+ (Internal), v2.5+ (External)
Recommendation: To keep your queries consistent across hot and cold data, modify your StarRocks internal table to use the STRUCT type. This will allow you to use the same dot-notation SQL for both federated Iceberg queries and local StarRocks queries.
References
• using_starrocks/Flat_json.md
• sql-reference/sql-functions/json-functions/overview-of-json-functions-and-operators.mdEliezer Talker
06/07/2026, 10:02 AMRocky
06/07/2026, 10:02 AMSTRUCT columns. This allows you to add or drop fields within a STRUCT as a metadata-only operation. This means there is no full rewrite of the data, and the change is nearly instantaneous.
How to do it correctly
To use STRUCT in your Primary Key table without worrying about future rewrites, you must follow these requirements:
1. Enable Fast Schema Evolution: You must set the property "fast_schema_evolution" = "true" when you create the table. (Note: This property currently cannot be enabled after the table is already created).
sql
CREATE TABLE hot_data (
id INT,
user_info STRUCT<name STRING, age INT>
) PRIMARY KEY (id)
DISTRIBUTED BY HASH(id)
PROPERTIES (
"fast_schema_evolution" = "true" -- REQUIRED for metadata-only changes
);
2. Use the specific ADD FIELD syntax: When you want to add a field later, do not use a generic MODIFY COLUMN that redefines the whole type. Use the specialized syntax:
sql
-- Adds a new field 'email' to the struct without rewriting data
ALTER TABLE hot_data MODIFY COLUMN user_info ADD FIELD email STRING;
Why this is better than JSON for your use case
• Dot Notation: You can use user_info.name on both your StarRocks hot tables and your Iceberg cold tables.
• Performance: STRUCT columns are more efficient for the StarRocks execution engine than JSON columns because they are strongly typed and benefit from StarRocks' columnar optimizations.
• Consistency: It allows your federated queries (joining hot and cold data) to use identical SQL syntax.
Summary: If you are on a recent version (v3.2.10+ or v3.3.2+), you can safely use STRUCT with the fast_schema_evolution property enabled to avoid the full data rewrite you feared.
References
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• administration/management/FE_configuration.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.mdEliezer Talker
06/07/2026, 10:36 AMRocky
06/07/2026, 10:37 AMfast_schema_evolution is enabled for the best experience (especially if you plan to add/drop fields inside a STRUCT as discussed previously).
• In version 4.0.x, it is still a best practice to set "fast_schema_evolution" = "true" in the PROPERTIES when creating your table.
• This property specifically optimizes the handling of default values and complex types (like your STRUCT columns) during schema changes.
3. When a rewrite IS required
There are only a few specific scenarios where StarRocks would still need a "Direct" or "Sorted" schema change (which involves a rewrite):
• Modifying the Primary Key: You cannot add or remove a column from the Primary Key definition without recreating the table.
• Changing Column Type: Changing a column from INT to BIGINT or STRING to JSON usually requires a data rewrite to transform the underlying physical storage.
• Modifying Sort Keys: If you have defined a separate ORDER BY key (different from the primary key) and try to change it, a rewrite is needed to re-sort the data.
Summary for your use case
Since you are using StarRocks as a "hot" layer for data that will eventually go to Iceberg:
• Adding new metrics/attributes: Fast and no rewrite (Metadata only).
• Dropping old fields: Fast and no rewrite (Metadata only).
• Adding fields to a `STRUCT`: Fast and no rewrite (if fast_schema_evolution is true).
Tip: Always check the status of a schema change by running SHOW ALTER TABLE COLUMN;. For value columns in 4.0.10, you will see them finish almost instantly.
References
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• table_design/table_types/primary_key_table.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
References
• best_practices/query_tuning/schema_tuning.md
• table_design/table_types/primary_key_table.md
• release_notes/release-3.2.md
• using_starrocks/async_mv/use_cases/data_modeling_with_materialized_views.mdRocky
06/07/2026, 10:37 AMNULL for existing rows.
* Dropping a Column: This is also a metadata-only change. The column is immediately "hidden" from the schema. The actual data is cleaned up in the background during normal compaction cycles, but the ALTER statement itself finishes almost instantly without rewriting the table.
Important Note on Enabling:
* Shared-Data (Cloud Native): Fast Schema Evolution is enabled by default in version 4.x.
* Shared-Nothing (Classic): You must have created the table with the property "fast_schema_evolution" = "true". This property currently cannot be added to an existing table; it must be set at CREATE TABLE time.
2. When a Full Rewrite IS Required
Even in version 4.0.10, certain changes still trigger a data rewrite (known as a "Direct" or "Sorted" schema change):
* Changing the Primary Key: You cannot add or remove a column from the PRIMARY KEY (...) definition without a table rewrite.
* Changing the Sort Key: If you have a separate ORDER BY (...) clause, adding or removing a column from that sort key requires re-sorting and rewriting the data files.
* Changing Data Types: Changing a column from INT to BIGINT or DATETIME to STRING requires a rewrite because the physical storage format changes.
3. How to Verify
When you run an ALTER TABLE command, you can check if it is performing a background rewrite or a metadata-only change by running:
sql
SHOW ALTER TABLE COLUMN;
If the status changes to FINISHED almost immediately, it was a metadata-only (Fast) schema change.
Summary Recommendation
Since you are using a Primary Key table for your "hot" data, as long as you keep your Primary Key and Sort Key stable, you can add and drop any other value columns (including your STRUCT columns) as much as you like without worrying about full data rewrites. Just ensure that if you are on a Shared-Nothing cluster, your CREATE TABLE statement includes "fast_schema_evolution" = "true".
References
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• table_design/table_types/primary_key_table.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
References
• table_design/table_types/primary_key_table.md
• knowledge/usage/best-practice.md
• best_practices/query_tuning/schema_tuning.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.mdEliezer Talker
06/07/2026, 10:40 AMfast_schema_evolution enabled by default ?
is there a disadvantage to having it enabled ?Rocky
06/07/2026, 10:40 AMfast_schema_evolution is not enabled by default for all table types (specifically in the "shared-nothing" or classic storage model) is primarily due to its architectural requirements and maturity.
Here is the breakdown of why it’s opt-in and what you should consider before using it:
1. Why it isn't enabled by default (Shared-Nothing)
* Immutability of Table Properties: In StarRocks, fast_schema_evolution changes how the Front End (FE) and Back End (BE) handle column metadata. Currently, this property must be set at table creation. If StarRocks were to enable it by default for a cluster, it could cause compatibility issues for users upgrading from older versions or for tools that expect the traditional "Linked Schema Change" behavior.
* Architectural Transition: StarRocks is moving toward making this the default. In fact, for shared-data (cloud-native) clusters, it is already enabled by default (since v3.3). For the classic shared-nothing model, it remains an explicit choice to ensure stability for legacy workloads.
2. Are there any disadvantages?
There are no major performance "penalties" to the data itself, but there are a few technical trade-offs:
* Permanent Decision: You cannot turn it on or off after the table is created. If you forget to enable it and later need to add a field to a STRUCT without a rewrite, you would have to recreate the entire table.
* Metadata Complexity: When you add a column "fast," the underlying data files on disk don't actually contain that column yet. The query engine has to "fill in" the default values or NULLs on the fly when reading old data. While this is very efficient, it adds a small amount of logic to the query execution process compared to a table where every column is physically present in every file.
* Beta Features: While adding/dropping standard columns is stable, the specific ability to add/drop fields within a STRUCT is still marked as a "Beta" feature in the documentation (as of v3.2.x/3.3.x). This means it is safe for most use cases but may have edge cases with extremely complex nested types.
Summary
For a "hot" table where you anticipate schema changes:
• Disadvantage: Essentially none, other than the fact that you have to remember to enable it at the start.
• Advantage: You save hours/days of "Full Rewrite" time and massive IO/CPU overhead during schema updates.
Verdict: For your StarRocks 4.0.10 cluster, you should definitely enable it for any new Primary Key tables you create, especially if you plan to use STRUCT columns.
sql
PROPERTIES (
"fast_schema_evolution" = "true"
)
References
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
• administration/management/FE_configuration.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md
• release_notes/release-3.2.md
References
• administration/management/FE_configuration.md
• sql-reference/sql-statements/table_bucket_part_index/CREATE_TABLE.md
• integrations/smt/starrocks_sqlalchemy.md
• table_design/hybrid_table.md
• best_practices/query_tuning/schema_tuning.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.md