Enforce exact length on inserts into Apache Iceberg™ fixed[L] columns (Preview)¶
Attention
This behavior change is in the 2026_02 bundle.
For the current status of the bundle, refer to Bundle history.
Snowflake will enforce exact length inserts into Iceberg fixed[L] column types.
- Before the change:
Columns that use the Iceberg
fixed[L]data type accept binary values up to the defined length ‘L’ in bytes. Values shorter than L are allowed.Values longer than L cause the query to fail.
- After the change:
Columns that use the Iceberg
fixed[L]data type accept binary values that exactly match the defined length ‘L’ in bytes. INSERT statements that attempt to insert a binary value shorter than L result in an error.This change aligns Snowflake with the Iceberg specification and other Iceberg-compatible engines, such as Apache Spark™.
The following list summarizes the behavior after this change is enabled:
This change applies to both new and existing Iceberg tables.
This change applies to both Snowflake-managed and externally managed Iceberg tables.
Regarding reads, this change has no impact on older snapshots or time travel. Existing snapshots will remain readable, as Snowflake only validates the length of the Iceberg
fixed[L]data type during DML operations.Regarding writes, with this change enabled, Snowflake will always enforce the correct length of the Iceberg
fixed[L]data type during write operations, including during time travel. Writes that attempt to insert a binary value that doesn’t exactly match the defined length ‘L’ in bytes will always fail. Values longer than L still cause the query to fail.
What you need to do to avoid any service interruption: Identify and resolve impacted columns.
Identify and resolve impacted columns¶
This section shows how to identify whether a column is impacted by this BCR and resolve the impacted columns.
Step 1: Identify impacted columns¶
To identify if you have any impacted columns, follow these steps:
Run the DESCRIBE ICEBERG TABLE command.
In the output, look for columns with source Iceberg type
fixed[L]. If you find a column of Iceberg typefixed[L], proceed to the next step.Run the following query:
SELECT BOOLOR_AGG(OCTET_LENGTH(<column_name>) != L) from <table_name>
If the query returns true, the column contains values of an incorrect length so the column is impacted.
Step 2: Resolve impacted columns¶
To resolve the impacted columns, do one of the following
Allow inserting binary values of arbitrary size into the impacted column, up to a maximum length
Allow inserting fixed-length binary values of length exactly L into the impacted column
Allow inserting binary values of arbitrary size into the impacted column, up to a maximum length¶
To resolve the impacted columns, you can allow inserting binary values of arbitrary size into the impacted column, up to a maximum length.
This resolution ensures that the metadata and physical files for the table are aligned with the Iceberg specification and are therefore compatible with external engines.
To allow inserting binary values of arbitrary size into the impacted column, up to a maximum length, follow these instructions:
If your table is accessed by external engines such as Spark, you must recreate the table by using column type BINARY.
To recreate the table by using column type BINARY, follow these steps:
To create and populate a new table that is based on the table with the impacted columns, run the CREATE ICEBERG TABLE … AS SELECT (also referred to as CTAS) command and specify binary as the data type for the impacted columns.
The following example shows a CTAS statement where the data type for column b in the new table is specified as binary:
CREATE ICEBERG TABLE my_table (..., b binary) AS SELECT * FROM my_old_table
Use the DROP ICEBERG TABLE command to remove the table with the impacted columns.
Alternatively, you can evolve the table schema by running the ALTER ICEBERG TABLE command to set the data type for the column to BINARY.
Important
Before you run an ALTER ICEBERG TABLE statement to change a column data type to BINARY, you must first contact Snowflake Support to enable this functionality for your account.
For example, the following statement evolves the schema for table
tby changing the data type for columnctoBINARY:ALTER ICEBERG TABLE t ALTER COLUMN c SET DATA TYPE BINARY;
This approach is a temporary, supported solution for affected customers during the BCR period. The advantage of this approach is that you only need to update the table schema instead of recreating the entire table.
Important
This approach is not a valid Iceberg type promotion, so external engines might detect an invalid type promotion and fail to refresh the table. Therefore, you should only use this approach with Snowflake-managed Iceberg tables that aren’t read by external engines or written to by external engines.
Allow inserting fixed-length binary values of length exactly L into the impacted column¶
To allow inserting fixed-length binary values of length exactly L into the impacted column, ensure that the size of the value that you input
matches the target size by adjusting your workflow, such as by using trimming or padding. We also recommend that you recreate the Iceberg
table with Iceberg column type fixed(L) to ensure that the size of any values you previously inserted in the table exactly match the
defined length L.
Ref: 2246