Updated on 2026-11-06 GMT+08:00

Iceberg Configurations and Types

Mapping between Spark types and Iceberg types

Spark and Iceberg support different type sets. Iceberg automatically performs type conversions, but not all mapping types are supported. Therefore, you need to understand the type conversions in Iceberg before designing the column types of a table.

Iceberg types corresponding to Spark types

The following table describes how Spark types are converted to Iceberg types. The conversion applies to both the creation of Iceberg tables and the writing of data to Iceberg tables through Spark.

Table 1 Iceberg types corresponding to Spark types

Spark

Iceberg

boolean

boolean

short

integer

byte

integer

integer

integer

long

long

float

float

double

double

date

date

timestamp

timestamp with timezone

timestamp_ntz

timestamp without timezone

char

string

varchar

string

string

string

binary

binary

decimal

decimal

struct

struct

array

list

map

map

This table mainly shows the type conversions at the time of table creation. In practice, a wider range of types are supported for conversions during write operations. Here are some key points during write operations:

  • Iceberg numeric types (integer, long, float, double, decimal) support type promotion during write operations. For example, you can write Spark data of the short, byte, integer, and long types to Iceberg data of the long type.
  • You can write Spark data of the binary type to Iceberg data of the fixed type. Note that length assertions will be performed during this process.

Spark types corresponding to Iceberg types

The following table describes how Iceberg types are converted to Spark types. The conversion applies to the reading of Iceberg tables through Spark.

Table 2 Spark types corresponding to Iceberg types

Iceberg

Spark

boolean

boolean

integer

integer

long

long

float

float

double

double

date

date

time

Not supported

timestamp with timezone

timestamp

timestamp without timezone

timestamp_ntz

string

string

uuid

string

fixed

binary

binary

binary

decimal

decimal

struct

struct

list

array

map

map

nanosecond timestamp

Not supported

nanosecond timestamp with timezone

Not supported

unknown

Not supported

variant

variant

NOTE:

Spark 4.0+ is supported.

geometry

Not supported

geography

Not supported

Runtime Configuration

Configuration Setting Priority

Iceberg allows configuration to be specified at different levels. The effective configuration for a read or write operation is determined by the following priority order:

  1. DataSourceAPI read/write options: Use .option(...) in read/write operations to explicitly transfer the options.
  2. Spark session configurations: Use spark.conf.set(...), spark-defaults.conf, or --conf in spark-submit for global settings.
  3. Table properties: Set the properties in the Iceberg table by running ALTER TABLE SET TBLPROPERTIES.
  4. Default value:

Use the next-level configurations as a backup if no higher-level configurations are defined. This allows global default values to be enabled when needed, maintaining flexibility.

Spark SQL options

Iceberg allows you to set various global behaviors using Spark SQL configuration options. These can be set using Spark, SparkSession configurations, or spark-submit parameters. For example:

//Disable vectorization.
val spark = SparkSession.builder()
.appName("IcebergExample")
.master("local[*]")
.config("spark.sql.catalog.my_catalog","org.apache.iceberg.spark.SparkCatalog")
.config("spark.sql.extensions","org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions")
.config("spark.sql.iceberg.vectorization.enabled","false")
.getOrCreate()

Spark Option

Default Value

Description

spark.sql.iceberg.vectorization.enabled

Inherits from table properties. (Parquet: the default value of read.parquet.vectorization.enabled is true. ORC: The default value of read.orc.vectorization.enabled is false.)

Controls whether to enable vectorized read of data files.

  • If this parameter is set to true, Iceberg uses batch-based columnar vectorization to accelerate queries, processing 5000 (specified by read.parquet.vectorization.batch-size or read.orc.vectorization.batch-size) rows at a time.
  • If this parameter is set to false, a non-vectorized row-by-row reader is used, which offers lower performance but better compatibility.

spark.sql.iceberg.parquet.reader-type

ICEBERG

Sets the Parquet reader implementation. The options are as follows:

  • ICEBERG (default value): Uses the built-in Parquet reader of Iceberg.
  • COMET: Uses the Apache DataFusion CometParquet reader (which performs I/O and decompression in the JVM, but decodes at the native layer to improve performance; also converts Spark physical plans to native execution).

spark.sql.iceberg.check-nullability

true

Checks whether the nullability of the write schema matches the nullability of the table.

  • If this parameter is set to true, an exception is thrown if a field declared as NOT NULL in the written data contains a null value.
  • If this parameter is set to false, the check is skipped and null values can be written into the NOT NULL fields (which may cause problems in subsequent queries).

spark.sql.iceberg.check-ordering

true

Checks whether the column order of the write schema matches the column order of the table schema.

  • If this parameter is set to true, an exception is thrown if the column order of the written data is inconsistent with that defined in the table.
  • If this parameter is set to false, the check is skipped. Columns can be matched by name instead of position.

spark.sql.iceberg.planning.preserve-data-grouping

false

  • If this parameter is set to true, scanning tasks of the same partition are placed in the same read shard for storage partitioned joins, which optimizes the locality of data in the partition.
  • If this parameter is set to false, scanning tasks are allocated based on the default policy. Data in the same partition may not be in the same partition.

spark.sql.iceberg.aggregate-push-down.enabled

true

Controls whether to push down aggregate functions (MAX, MIN, and COUNT).

  • If this parameter is set to true, Iceberg attempts to push aggregation calculations into the data file read layer and uses file-level statistics (such as min/max values) to skip unnecessary data reads.
  • If this parameter is set to false, all aggregation calculations are completed at the Spark layer.

spark.sql.iceberg.distribution-mode

Determined based on your environment:

  • If the table has a sorting order, the value is range.
  • If the table has partitions, the value is hash.
  • In other cases, the value is none.

Controls the data distribution policy during write operations. The options are as follows:

  • none: Data is not redistributed.
  • hash: Hash distribution is performed based on the partition key. This is applicable to scenarios where data is evenly distributed in partitions.
  • range: Range distribution is performed based on the partition key or sorting key. This is applicable to data skew scenarios.

For details, see Writing Data to an Iceberg Table.

spark.wap.id

null

Specifies the write-audit-release (WAP) snapshot staging ID.

After this parameter is set, a new snapshot is created in the staged state and associated with this ID. You need to manually publish the snapshot. If this parameter is set to null, the snapshot is directly committed. Before setting this parameter, set the table property write.wap.enabled to true.

spark.wap.branch

null

Specifies the WAP branch name. After this parameter is set, the snapshot is committed to the specified branch instead of the main branch to isolate the development or test environment. If this parameter is set to null, the snapshot is committed to the current branch.

Before setting this parameter, set the table property write.wap.enabled to true.

spark.sql.iceberg.compression-codec

Inherits from table properties. (Parquet: The default value of write.parquet.compression-codec is zstd. Avro: The default value of write.avro.compression-codec is gzip. ORC: The default value of write.orc.compression-codec is zlib.)

Specifies the compression codec used for writing data. Different file formats support different codecs:

  • Parquet files support the uncompressed, snappy, gzip, lz4, zstd, brotli, lzop, bz2, and zstd-no-seek codecs.
  • Avro files support the null (no compression), deflate, snappy, bzip2, xz, lz4, and zstd codecs.
  • ORC files support the none, snappy, zlib, lz4, lzo and zstd codecs

spark.sql.iceberg.compression-level

Inherits from table properties (Parquet: the default value of write.parquet.compression-level is null. Avro: the default value of write.avro.compression-level is null.)

Specifies the compression level of Parquet/Avro files. Generally, the value is an integer ranging from 1 to 9. A larger value indicates a higher compression ratio but a slower speed. The default value null indicates that the default level of the codec is used. This parameter is valid only for codecs that support level configurations, such as gzip, zstd, and deflate.

spark.sql.iceberg.compression-strategy

Inherits from the table property write.orc.compression-strategy (default value: speed).

Specifies the ORC compression policy. The options are as follows:

  • speed (default value): The compression speed is prioritized to reduce CPU usage.
  • compression: The compression ratio is prioritized to reduce storage usage.

spark.sql.iceberg.data-planning-mode

Inherits from the table property read.data-planning-mode (default value: AUTO).

Specifies the scan planning mode of data files. The options are as follows:

  • AUTO (default value): The system automatically selects LOCAL or DISTRIBUTED based on the number of manifest files.
  • LOCAL: All files are planned to be executed in the Driver process.
  • DISTRIBUTED: Files are planned and distributed to Spark Executors for execution. (This requires the value of spark.driver.maxResultSize be no less than 256 MB. Otherwise, the LOCAL mode is used.)

spark.sql.iceberg.delete-planning-mode

Inherits from the table property read.delete-planning-mode (default value: AUTO).

Specifies the scan planning mode of the deletion files. The options are as follows:

  • AUTO (default value): The system automatically selects a value.
  • LOCAL: This planning is performed on the Driver.
  • DISTRIBUTED: The distributed planning is used. (This requires the value of spark.driver.maxResultSize be no less than 256 MB. Otherwise, the LOCAL mode is used.)

spark.sql.iceberg.advisory-partition-size

Inherits from the table property write.target-file-size-bytes (default value: 536870912, that is, 512 MB).

Specifies the recommended partition size (in bytes) for writing data to a table when Spark Adaptive Query Execution (AQE) is enabled. It is used to adjusts the size of the output files, which affects the amount of data written by each task.

spark.sql.iceberg.locality.enabled

false

Controls whether to report the localization information of Spark tasks on the executor.

  • If this parameter is set to true, Iceberg reports the localized location of data blocks to Spark so that Spark can schedule compute tasks to the nodes where the data is stored, thereby reducing network transmission. This parameter is valid for storage systems that support data locality, such as HDFS, but is invalid for object storage systems like OBS/S3.
  • If this parameter is set to false, Spark randomly allocates tasks to executors.

spark.sql.iceberg.executor-cache.enabled

true

Controls whether to enable the cache on the executor.

  • If this parameter is set to true, Iceberg caches DeleteFiles on the executor to avoid repeated reads during row-level operations.
  • If this parameter is set to false, the file is read from the storage for each operation.

spark.sql.iceberg.executor-cache.timeout

10 (10 minutes)

Specifies the timeout interval for a cache entry, in minutes. Cache entries that are not accessed within this period will be cleared.

spark.sql.iceberg.executor-cache.max-entry-size

67108864 (64 MB)

Specifies the maximum size of each cache entry, in bytes. Files larger than this size will not be cached.

spark.sql.iceberg.executor-cache.max-total-size

134217728 (128 MB)

Specifies the maximum total size of the executor cache, in bytes. When the total cache size exceeds this value, old entries are evicted based on the least recently used (LRU) policy.

spark.sql.iceberg.executor-cache.locality.enabled

false

  • Controls whether to enable the locality-aware executor cache usage. If this parameter is set to true, cache hits are prioritized on the executor where data is localized, reducing cross-node cache lookups.
  • If this parameter is set to false, data locality is not considered during cache lookup.

spark.sql.iceberg.merge-schema

false

Controls whether to modify the table schema to match the schema of the written data.

  • If this parameter is set to true, Iceberg automatically adds new columns that do not exist in the table to the table schema. Only missing columns are added. Existing columns are not deleted or modified.
  • If this parameter is set to false, an exception is thrown if the written data contains a column that does not exist in the table schema.

spark.sql.iceberg.report-column-stats

true

Controls whether to report the Puffin table statistics to the cost-based optimizer (CBO) of Spark.

  • If this parameter is set to true, Iceberg transfers column statistics (such as NDV and null value count) to Spark CBO to optimize the query plan.
  • If this parameter is set to false, Iceberg does not report column statistics to Spark CBO.

    This parameter takes effect only when Spark CBO is enabled (spark.sql.cbo.enabled is set to true).

Read options

Spark read options are transferred when DataFrame Reader is configured, as shown below:

//Time travel
spark.read
.option("snapshot-id",10963874102873L)
.table("catalog.db.table")

Spark Option

Default Value

Description

snapshot-id

null

Specifies the ID (long type) of the table snapshot to be read. It is used for the TimeTravel function to read data from a specified historical version. This parameter is mutually exclusive with as-of-timestamp. If this parameter is set to null, the latest snapshot is read.

as-of-timestamp

null

Specifies a timestamp in milliseconds (long type). If this parameter is set, the latest snapshot generated before this timestamp is used. It is used for time-based historical data query. This parameter is mutually exclusive with snapshot-id. If both parameters are set, snapshot-id takes precedence. If this parameter is set to null, the latest snapshot is read.

split-size

Inherits from the table properties. (The default value of read.split.target-size is 134217728, that is, 128 MB. The default value of read.split.metadata-target-size is 33554432, that is, 32 MB.)

Overrides the table's read.split.target-size (target size of data file splitting) and read.split.metadata-target-size (target size of metadata file splitting). It is used to control the amount of data processed by each Spark task. A smaller value indicates more tasks to be generated.

lookback

Inherits from the table property read.split.planning-lookback (default value: 10).

Overrides the table's read.split.planning-lookback. It specifies the number of files that are backtracked when splits are planned, which is used to merge small files into the same split. A larger value indicates more files to be merged but a longer planning time.

file-open-cost

Inherits from the table property read.split.open-file-cost. The default value is 4194304, that is, 4 MB.

Overrides the table's read.split.open-file-cost. It indicates the estimated cost (in bytes) of opening a file, which is used for cost optimization during split planning.

vectorization-enabled

Inherits from table properties. (Parquet: the default value of read.parquet.vectorization.enabled is true. ORC: The default value of read.orc.vectorization.enabled is false.)

Overrides the vectorized read switch of this table. If this parameter is set to true, Parquet/ORC vectorized read is enabled, and columnar batch processing is used to improve query performance. If this parameter is set to false, a non-vectorized row-by-row reader is used, which offers lower performance but better compatibility.

batch-size

Inherits from table properties. (Parquet: The default value of read.parquet.vectorization.batch-size is 5000. ORC: The default value of read.orc.vectorization.batch-size is 5000.)

Overrides the vectorized batch size of this table, that is, the number of rows processed in each batch. Larger batches (for example, 10,000) increase throughput but also increase memory consumption. Smaller batches (for example, 1,000) reduce memory usage but decrease throughput.

stream-from-timestamp

null

Specifies a timestamp (long type) in milliseconds as the start point for streaming. If the timestamp is earlier than the oldest known ancestor snapshot, the oldest snapshot is used. If this parameter is set to null, streaming reads start from the latest snapshot.

streaming-max-files-per-micro-batch

Integer.MAX_VALUE (2147483647)

Specifies the maximum number of files per micro-batch. It is used to control the number of files processed in each batch of the structured streaming. Setting a smaller value can prevent delays caused by large batches.

streaming-max-rows-per-micro-batch

Integer.MAX_VALUE (2147483647)

Specifies the maximum number of rows per micro-batch (soft limit).

When the streaming-max-rows-per-micro-batch option defines a soft maximum value, a batch will always contain all rows in the next unprocessed data file. However, if including additional files would exceed the soft maximum limit, those files will not be included.

Write options

Spark write options are transferred when DataFrameWriterV2 is configured, as shown below:

//Use Avro instead of Parquet for writing.
df.writeTo("catalog.db.table")
.option("write-format","avro")
.option("snapshot-property.key","value")
.append()

Spark Option

Default Value

Description

write-format

Inherits from the table property write.format.default (default value: parquet).

Specifies the file format used for the write operation. The options are as follows:

  • parquet (default)
  • avro
  • orc

target-file-size-bytes

Inherits from the table property write.target-file-size-bytes (default value: 536870912, that is, 512 MB).

Overrides the table's write.target-file-size-bytes. It is used to control the target size of each output data file. A smaller value results in more small files (which may increase the scanning overhead during queries), while a larger value reduces the number of files but increases the size of a single file (which may increase memory consumption).

check-nullability

true

Controls whether to perform the nullability check on a field. If this parameter is set to true, an exception is thrown if a field declared as NOT NULL in the written data contains a null value. If this parameter is set to false, this check is skipped and null values can be written to the NOT NULL field (which may cause subsequent query exceptions).

snapshot-property.custom-key

null

Adds an entry with a custom key and corresponding value to the snapshot summary. For example, snapshot-property.user=alice will add {"user":"alice"} to the snapshot metadata. This parameter is used for audit tracking or change marking. (The DSv2 API requires the prefix snapshot-property.)

fanout-enabled

false

Overrides the table's write.spark.fanout.enabled.

  • If this parameter is set to true, data is written by partition to prevent a single task from writing to too many partitions (one write task per partition). This is suitable for scenarios where data needs to be written to a large number of partitions, but it increases the shuffle overhead and memory consumption.
  • If this parameter is set to false, a single task is written to multiple partitions, which may cause memory pressure when data is written to a large number of partitions.

check-ordering

true

Checks whether the input schema is the same as the table schema.

  • If this parameter is set to true, an exception is thrown if the column order of the written data is inconsistent with that defined in the table.
  • If this parameter is set to false, the check is skipped. Columns can be matched by name instead of position.

isolation-level

null

Specifies the isolation level required for DataFrame overwrite operations. The options are as follows:

  • null (default): No check is performed. This is suitable for idempotent writes.
  • serializable: Checks concurrent insert or delete operations in the target partition to ensure full isolation.
  • snapshot: Checks only concurrent deletions in the target partition and allows concurrent insertions.

Default values for table properties:

  • The default value of write.delete.isolation-level is serializable.
  • The default value of write.update.isolation-level is serializable.
  • The default value of write.merge.isolation-level is serializable.

validate-from-snapshot-id

null

If the isolation level is set, this parameter specifies the baseline snapshot ID (of the long type) for checking concurrent write conflicts in the table. It should be the ID of any snapshot before the table is read. You can obtain the value from the Table API or Snapshots table. If this parameter is set to null, the oldest known snapshot of the table is used.

compression-codec

Inherits from table properties. (Parquet: The default value of write.parquet.compression-codec is zstd. Avro: The default value of write.avro.compression-codec is gzip. ORC: The default value of write.orc.compression-codec is zlib.)

Overrides the compression codec used for writing data to this table.

  • For Parquet, the value can be uncompressed, snappy, gzip, lz4, zstd, brotli, lzop, bz2 or zstd-no-seek.
  • For Avro, the value can be null (no compression), deflate, snappy, bzip2, xz, lz4, or zstd.
  • For ORC, the value can be none, snappy, zlib, lz4, lzo or zstd.

compression-level

Inherits from table properties (Parquet: the default value of write.parquet.compression-level is null. Avro: the default value of write.avro.compression-level is null.)

Overrides the compression level used for writing data in Parquet and Avro formats to this table. The value is an integer ranging from 1 to 9. A larger value indicates a higher compression ratio but a slower compression speed. The default value null indicates that the default level of the codec is used. This parameter is valid only for codecs that support level configurations, such as gzip, zstd, and deflate.

compression-strategy

Inherits from the table property write.orc.compression-strategy (default value: speed).

Overrides the compression strategy used for writing data in ORC format to this table. The options are as follows:

  • speed (default value): The compression speed is prioritized to reduce CPU usage.
  • compression: The compression ratio is prioritized to reduce storage usage.

distribution-mode

Determined based on your environment. If the table has a sorting order, the value is range. If the table has partitions, the value is hash. In other cases, the value is none.

Overrides the distribution mode used for writing data to this table. The options are as follows:

  • none: Data is not redistributed.
  • hash: Data is distributed by partition key in hash mode. This is applicable to scenarios where data is evenly distributed in partitions.
  • range: Range distribution is performed based on the partition key or sorting key. This is applicable to data skew scenarios.

Default values for table properties:

The default values of write.delete.distribution-mode, write.update.distribution-mode, and write.merge.distribution-mode are hash.

For details, see Writing Data to an Iceberg Table.

delete-granularity

file

Overrides the write and delete granularity used for this table. The options are as follows:

  • file (default value): Data is deleted by file. A position delete file is generated to point to a specific data file line.
  • partition: Data is deleted by partition. A partition delete file is generated to mark the entire partition as deleted. (The default value of the table property write.delete.granularity is partition.)

This parameter affects the efficiency of the DELETE operations. The file level is more accurate but generates more small files. The partition level is more efficient but deletes the entire partition.